]>
Commit | Line | Data |
---|---|---|
38a30030 | 1 | // Author: Benjamin Hess 25/09/2008 |
2670605d | 2 | |
3 | /************************************************************************* | |
4 | * Copyright (C) 2008, Alexandru Bercuci, Benjamin Hess. * | |
5 | * All rights reserved. * | |
6 | *************************************************************************/ | |
7 | ||
16db6074 | 8 | ////////////////////////////////////////////////////////////////////////// |
9 | // // | |
2670605d | 10 | // AliEveTRDTrackList // |
11 | // // | |
16db6074 | 12 | // An AliEveTRDTrackList is, in principal, a TEveElementList with some // |
13 | // sophisticated features. You can add macros to this list, which then // | |
14 | // can be applied to the list of tracks (these tracks can be added to // | |
15 | // the list in the same way as for the TEveElementList). In general, // | |
16 | // please use AddMacro(...) for this purpose. // | |
17 | // Macros that are no longer needed can be removed from the list via // | |
38a30030 | 18 | // RemoveSelectedMacros(...).This function takes an iterator of the // |
19 | // list of macros that are to be removed. // | |
16db6074 | 20 | // be removed. An entry looks like: // |
38a30030 | 21 | // The data for each macro consists of path, name, type and the command // |
22 | // that will be used to apply the macro. This stuff is stored in a map // | |
23 | // which takes the macro name for the key and the above mentioned data // | |
24 | // in a TMacroData-object for the value. // | |
25 | // You can get the macro type via GetMacroType(...). // | |
2670605d | 26 | // With ApplySTSelectionMacros(...) or ApplyProcessMacros(...) // |
16db6074 | 27 | // respectively you can apply the macros to the track list via // |
38a30030 | 28 | // iterators (same style like for RemoveSelectedMacros(...)(cf. above)).// |
16db6074 | 29 | // Selection macros (de-)select macros according to a selection rule // |
30 | // by setting the rnr-state of the tracks. // | |
31 | // If multiple selection macros are applied, a track is selected, if // | |
32 | // all selection macros select the track. // | |
33 | // Process macros create data or histograms, which will be stored in // | |
34 | // a temporary file. The editor of this class will access this file // | |
35 | // and draw all the stuff within it's DrawHistos() function. The file // | |
36 | // will be deleted by the destructor. // | |
37 | // // | |
38 | // Currently, the following macro types are supported: // | |
39 | // Selection macros: // | |
40 | // Bool_t YourMacro(const AliTRDtrackV1*); // | |
41 | // Bool_t YourMacro(const AliTRDtrackV1*, const AliTRDtrackV1*); // | |
42 | // // | |
43 | // Process macros: // | |
44 | // void YourMacro(const AliTRDtrackV1*, Double_t*&, Int_t&); // | |
45 | // void YourMacro(const AliTRDtrackV1*, const AliTRDtrackV1*, // | |
46 | // Double_t*&, Int_t&); // | |
47 | // TH1* YourMacro(const AliTRDtrackV1*); // | |
48 | // TH1* YourMacro(const AliTRDtrackV1*, const AliTRDtrackV1*); // | |
49 | // // | |
38a30030 | 50 | // The macros which take 2 tracks are applied to all track pairs // |
51 | // (whereby BOTH tracks of the pair have to be selected by the single // | |
52 | // track selection macros and have to be unequal, otherwise they will // | |
53 | // be skipped) that have been selected by ALL correlated tracks // | |
54 | // selection macros. The selection macros with 2 tracks do NOT affect // | |
55 | // process macros that process only a single track! // | |
16db6074 | 56 | ////////////////////////////////////////////////////////////////////////// |
57 | ||
58 | ||
caaf90d2 | 59 | // Uncomment to display debugging infos |
60 | //#define ALIEVETRDTRACKLIST_DEBUG | |
61 | ||
caaf90d2 | 62 | #include <TFile.h> |
63 | #include <TFunction.h> | |
c413e8d4 | 64 | #include <TH1.h> |
caaf90d2 | 65 | #include <TList.h> |
8bdeb570 | 66 | #include <TMap.h> |
caaf90d2 | 67 | #include <TObjString.h> |
68 | #include <TROOT.h> | |
69 | #include <TSystem.h> | |
70 | #include <TTree.h> | |
71 | #include <TTreeStream.h> | |
db16b708 | 72 | #include <TMethodCall.h> |
73 | ||
74 | #include <AliTRDReconstructor.h> | |
75 | ||
76 | #include <EveDet/AliEveTRDTrackList.h> | |
77 | #include <EveDet/AliEveTRDTrackList.h> | |
78 | #include <EveDet/AliEveTRDTrackListEditor.h> | |
79 | ||
80 | #include <qaRec/AliTRDrecoTask.h> | |
81b4050b | 81 | #include <qaRec/macros/AliTRDperformanceTrain.h> |
ecbbe371 | 82 | |
2ef0687e | 83 | ClassImp(AliEveTRDTrackList) |
84 | ||
85 | /////////////////////////////////////////////////////////// | |
86 | ///////////// AliEveTRDTrackList //////////////////////// | |
87 | /////////////////////////////////////////////////////////// | |
8bdeb570 | 88 | AliEveTRDTrackList::AliEveTRDTrackList(const Text_t* n, const Text_t* t, Bool_t doColor): |
89 | TEveElementList(n, t, doColor), | |
1e536dd4 | 90 | fEditor(0x0), |
91 | fDataFromMacroList(0x0), | |
92 | fMacroList(0x0), | |
93 | fDataTree(0x0), | |
8bdeb570 | 94 | fHistoDataSelected(0), |
95 | fMacroListSelected(0), | |
8bdeb570 | 96 | fSelectedTab(1), // Standard tab: "Apply macros" (index 1) |
1e536dd4 | 97 | fSelectedStyle(0) |
2ef0687e | 98 | { |
16db6074 | 99 | // Creates the AliEveTRDTrackList. |
100 | ||
caaf90d2 | 101 | // Only accept childs of type AliEveTRDTrack |
2ef0687e | 102 | SetChildClass(AliEveTRDTrack::Class()); |
103 | ||
e007877e | 104 | // Allocate memory for the lists and declare them as owners of their contents |
caaf90d2 | 105 | fDataFromMacroList = new TList(); |
e007877e | 106 | fDataFromMacroList->TCollection::SetOwner(kTRUE); |
caaf90d2 | 107 | |
38a30030 | 108 | fMacroList = new TMap(); |
e007877e | 109 | // Set map to owner of it's objects to delete them, if they are removed from the map |
38a30030 | 110 | fMacroList->SetOwnerKeyValue(kTRUE, kTRUE); |
8bdeb570 | 111 | |
ecbbe371 | 112 | // Set the build directory for AClic |
1e536dd4 | 113 | if(gSystem->AccessPathName(Form("%s/.trdQArec" , gSystem->Getenv("HOME")))) gSystem->Exec("mkdir $HOME/.trdQArec"); |
114 | gSystem->SetBuildDir(Form("%s/.trdQArec", gSystem->Getenv("HOME"))); | |
caaf90d2 | 115 | |
db16b708 | 116 | AddStandardContent(); |
caaf90d2 | 117 | } |
118 | ||
8e27fca1 | 119 | //______________________________________________________ |
caaf90d2 | 120 | AliEveTRDTrackList::~AliEveTRDTrackList() |
121 | { | |
16db6074 | 122 | // Frees allocated memory (lists etc.). |
123 | ||
38a30030 | 124 | // Let the editor know that the list will be destroyed -> The editor will save the data |
125 | if (fEditor != 0) | |
caaf90d2 | 126 | { |
38a30030 | 127 | fEditor->SaveMacroList(fMacroList); |
128 | fEditor = 0; | |
caaf90d2 | 129 | } |
38a30030 | 130 | |
caaf90d2 | 131 | if (fDataFromMacroList != 0) |
132 | { | |
c413e8d4 | 133 | fDataFromMacroList->Delete(); |
caaf90d2 | 134 | delete fDataFromMacroList; |
135 | fDataFromMacroList = 0; | |
136 | } | |
137 | if (fDataTree != 0) | |
138 | { | |
139 | delete fDataTree; | |
140 | fDataTree = 0; | |
141 | } | |
38a30030 | 142 | if (fMacroList != 0) |
8bdeb570 | 143 | { |
38a30030 | 144 | fMacroList->DeleteAll(); |
145 | delete fMacroList; | |
146 | fMacroList = 0; | |
8bdeb570 | 147 | } |
ecbbe371 | 148 | // Note: gSystem->AccessPathName(...) returns kTRUE, if the access FAILED! |
149 | if(!gSystem->AccessPathName(Form("/tmp/TRD.TrackListMacroData_%s.root", gSystem->Getenv("USER")))) | |
150 | gSystem->Exec(Form("rm /tmp/TRD.TrackListMacroData_%s.root", gSystem->Getenv("USER"))); | |
caaf90d2 | 151 | } |
152 | ||
8e27fca1 | 153 | //______________________________________________________ |
c413e8d4 | 154 | Int_t AliEveTRDTrackList::AddMacro(const Char_t* path, const Char_t* nameC, Bool_t forceReload) |
caaf90d2 | 155 | { |
16db6074 | 156 | // Checks, if the file exists and if the signature is correct. |
157 | // If these criteria are fullfilled, the library for this macro is built | |
158 | // and the macro is added to the corresponding list. | |
159 | // Supported macro types: | |
160 | // Selection macros: | |
161 | // Bool_t YourMacro(const AliTRDtrackV1*) | |
162 | // Bool_t YourMacro(const AliTRDtrackV1*, const AliTRDtrackV1*) | |
163 | // | |
164 | // Process macros: | |
165 | // void YourMacro(const AliTRDtrackV1*, Double_t*&, Int_t&) | |
166 | // void YourMacro(const AliTRDtrackV1*, const AliTRDtrackV1*, | |
167 | // Double_t*&, Int_t&) | |
168 | // TH1* YourMacro(const AliTRDtrackV1*) | |
38a30030 | 169 | // TH1* YourMacro(const AliTRDtrackV1*, const AliTRDtrackV1*) |
caaf90d2 | 170 | |
4f6473f6 | 171 | Char_t pathname[fkMaxMacroPathNameLength]; |
172 | memset(pathname, '\0', sizeof(Char_t) * fkMaxMacroPathNameLength); | |
caaf90d2 | 173 | |
174 | // Expand the path and create the pathname | |
175 | Char_t* systemPath = gSystem->ExpandPathName(path); | |
176 | sprintf(pathname, "%s/%s", systemPath, nameC); | |
177 | delete systemPath; | |
178 | systemPath = 0; | |
179 | ||
180 | // Delete ".C" from filename | |
4f6473f6 | 181 | Char_t name[fkMaxMacroNameLength]; |
182 | memset(name, '\0', sizeof(Char_t) * fkMaxMacroNameLength); | |
183 | ||
184 | for (UInt_t ind = 0; ind < fkMaxMacroNameLength && ind < strlen(nameC) - 2; ind++) name[ind] = nameC[ind]; | |
caaf90d2 | 185 | |
186 | // Check, if files exists | |
db16b708 | 187 | FILE* fp = 0x0; |
188 | if((fp = fopen(pathname, "rb"))){ | |
caaf90d2 | 189 | fclose(fp); |
db16b708 | 190 | fp = 0x0; |
191 | } else return NOT_EXIST_ERROR; | |
38a30030 | 192 | |
caaf90d2 | 193 | // Clean up root, load the desired macro and then check the type of the macro |
db16b708 | 194 | // A.B. gROOT->Reset(); |
c413e8d4 | 195 | |
db16b708 | 196 | gROOT->ProcessLineSync(Form(".L %s+%c", pathname, forceReload ? '+' : ' ')); |
caaf90d2 | 197 | |
38a30030 | 198 | AliEveTRDTrackListMacroType type = GetMacroType(name, kFALSE); |
caaf90d2 | 199 | |
4f6473f6 | 200 | // Clean up again |
db16b708 | 201 | // A.B. gROOT->Reset(); |
4f6473f6 | 202 | |
caaf90d2 | 203 | // Has not the correct signature! |
38a30030 | 204 | if (type == kUnknown) return SIGNATURE_ERROR; |
caaf90d2 | 205 | |
caaf90d2 | 206 | // Only add macro, if it is not already in the list |
db16b708 | 207 | Int_t returnValue = WARNING; |
208 | if(fMacroList->GetValue(name) == 0) { | |
209 | returnValue = AddMacroFast(path, name, type) ? SUCCESS : ERROR; | |
caaf90d2 | 210 | } |
caaf90d2 | 211 | return returnValue; |
212 | } | |
c413e8d4 | 213 | |
214 | //______________________________________________________ | |
38a30030 | 215 | Bool_t AliEveTRDTrackList::AddMacroFast(const Char_t* path, const Char_t* name, AliEveTRDTrackListMacroType type) |
c413e8d4 | 216 | { |
38a30030 | 217 | // Adds a macro (path/name) to the corresponding list. No checks are performed (file exist, |
218 | // macro already in list/map, signature correct), no libraries are created! | |
219 | // You can use this function only, if the macro has been added successfully before | |
220 | // (and then maybe was removed). The function is very fast. On success kTRUE is returned, otherwise: kFALSE; | |
221 | ||
222 | Bool_t success = kFALSE; | |
16db6074 | 223 | |
8bdeb570 | 224 | switch (type) |
c413e8d4 | 225 | { |
e007877e | 226 | case kSingleTrackSelect: |
227 | case kCorrelTrackSelect: | |
e007877e | 228 | case kSingleTrackAnalyse: |
229 | case kSingleTrackHisto: | |
230 | case kCorrelTrackAnalyse: | |
231 | case kCorrelTrackHisto: | |
38a30030 | 232 | fMacroList->Add(new TObjString(name), new TMacroData(name, path, type)); |
8bdeb570 | 233 | |
234 | // We do not know, where the element has been inserted - deselect this list | |
235 | fMacroListSelected = 0; | |
38a30030 | 236 | |
237 | success = kTRUE; | |
238 | ||
239 | #ifdef ALIEVETRDTRACKLIST_DEBUG | |
240 | // Successfull add will only be displayed in debug mode | |
241 | printf("AliEveTRDTrackList::AddMacroFast: Added macro \"%s/%s\" to the corresponding list\n", path, name); | |
242 | #endif | |
243 | ||
8bdeb570 | 244 | break; |
c413e8d4 | 245 | |
38a30030 | 246 | default: |
247 | // Error will always be displayed | |
248 | printf("AliEveTRDTrackList::AddMacroFast: ERROR: Could not add macro \"%s/%s\" to the corresponding list\n", | |
249 | path, name); | |
16db6074 | 250 | |
38a30030 | 251 | success = kFALSE; |
caaf90d2 | 252 | |
38a30030 | 253 | break; |
c413e8d4 | 254 | } |
38a30030 | 255 | |
256 | return success; | |
caaf90d2 | 257 | } |
c413e8d4 | 258 | |
8e27fca1 | 259 | //______________________________________________________ |
db16b708 | 260 | void AliEveTRDTrackList::AddStandardContent() |
caaf90d2 | 261 | { |
38a30030 | 262 | // Adds standard macros to the macro list. |
16db6074 | 263 | |
caaf90d2 | 264 | // Add your standard macros here, e.g.: |
8bdeb570 | 265 | // To add a macro use: |
caaf90d2 | 266 | // AddMacro("$(ALICE_ROOT)/myFolder", "myMacroName.C"); |
267 | // -> If the file does not exist, nothing happens. So if you want to handle this, | |
268 | // use the return value of AddMacro (NOT_EXIST_ERROR is returned, if file does not exist) | |
5715955a | 269 | // (-> You can also check for other return values (see AddMacro(...))) |
db16b708 | 270 | |
271 | if(gSystem->Load("libANALYSIS.so")<0) return; | |
272 | if(gSystem->Load("libTRDqaRec.so")<0) return; | |
273 | AliTRDrecoTask *task = 0x0; | |
274 | TList *fPlots = 0x0; | |
81b4050b | 275 | for(Int_t it=0; it<NTRDQATASKS; it++){ |
db16b708 | 276 | TClass c(fgkTRDtaskClassName[it]); |
277 | task = (AliTRDrecoTask*)c.New(); | |
50db8cc0 | 278 | task->SetMCdata(kFALSE); |
db16b708 | 279 | if(!(fPlots = task->GetPlotFunctors())){ |
50db8cc0 | 280 | //AliWarning(Form("No Plot functors defined for task \"%s\"", fgkTRDtaskClassName[it])); |
db16b708 | 281 | delete task; |
282 | continue; | |
283 | } | |
284 | if(!(task->Histos())){ | |
50db8cc0 | 285 | //AliWarning(Form("No Ref Histograms defined for task \"%s\"", fgkTRDtaskClassName[it])); |
db16b708 | 286 | delete task; |
287 | continue; | |
288 | } | |
289 | ||
290 | // export task to CINT and add functions | |
291 | gROOT->ProcessLine(Form("%s* %s = (%s*)0x%lx;", fgkTRDtaskClassName[it], task->GetName(), fgkTRDtaskClassName[it], (void*)task)); | |
292 | TIter iter(fPlots); TMethodCall *m = 0x0; | |
293 | while((m = dynamic_cast<TMethodCall*>(iter()))){ | |
294 | AddMacroFast("", Form("%s->%s", task->GetName(), m->GetMethodName()), kSingleTrackHisto); | |
295 | } | |
296 | } | |
caaf90d2 | 297 | } |
298 | ||
8e27fca1 | 299 | //______________________________________________________ |
2670605d | 300 | Bool_t AliEveTRDTrackList::ApplyProcessMacros(const TList* selIterator, const TList* procIterator) |
caaf90d2 | 301 | { |
2670605d | 302 | // Uses the procIterator (for the selected process macros) to apply the selected macros to the data. |
16db6074 | 303 | // Returns kTRUE on success, otherwise kFALSE. If there no process macros selected, kTRUE is returned |
304 | // (this is no error!). | |
2670605d | 305 | // The single track process macros are applied to all selected tracks. |
306 | // The selIterator (for the selected selection macros) will be used to apply the correlated tracks selection | |
307 | // macros to all track pairs (whereby BOTH tracks have to be selected, otherwise they will be skipped). | |
308 | // All track pairs that have been selected by ALL correlated tracks selection macros will be processed by | |
309 | // the correlated tracks process macros. | |
16db6074 | 310 | |
ea24e1bc | 311 | // No process macros need to be processed |
2670605d | 312 | if (procIterator->GetEntries() <= 0) return kTRUE; |
ea24e1bc | 313 | |
314 | // Clear root | |
db16b708 | 315 | // A.B. gROOT->Reset(); |
ea24e1bc | 316 | |
317 | // Clear old data and re-allocate | |
db16b708 | 318 | if (fDataTree == 0x0){ |
319 | TDirectory *cwd = gDirectory; | |
320 | fDataTree = new TTreeSRedirector(Form("/tmp/TRD.TrackListMacroData_%s.root", gSystem->Getenv("USER"))); | |
321 | cwd->cd(); | |
322 | } | |
323 | if (!fDataTree){ | |
324 | Error("Apply process macros", Form("File \"/tmp/TRD.TrackListMacroData_%s.root\" could not be accessed properly!", gSystem->Getenv("USER"))); | |
ea24e1bc | 325 | return kFALSE; |
326 | } | |
327 | ||
db16b708 | 328 | if (fDataFromMacroList != 0) { |
e007877e | 329 | fDataFromMacroList->Delete(); |
330 | delete fDataFromMacroList; | |
331 | } | |
ea24e1bc | 332 | fDataFromMacroList = new TList(); |
e007877e | 333 | fDataFromMacroList->TCollection::SetOwner(kTRUE); |
ea24e1bc | 334 | |
335 | fHistoDataSelected = 0; | |
336 | ||
8e27fca1 | 337 | |
38a30030 | 338 | TMacroData* macro = 0; |
339 | ||
340 | Char_t** procCmds = 0; | |
341 | AliEveTRDTrackListMacroType* mProcType = 0; | |
db16b708 | 342 | if (procIterator->GetEntries() > 0) { |
38a30030 | 343 | procCmds = new Char_t*[procIterator->GetEntries()]; |
344 | mProcType = new AliEveTRDTrackListMacroType[procIterator->GetEntries()]; | |
345 | } | |
2670605d | 346 | |
38a30030 | 347 | Char_t** selCmds = 0; |
348 | AliEveTRDTrackListMacroType* mSelType = 0; | |
db16b708 | 349 | if (selIterator->GetEntries() > 0) { |
38a30030 | 350 | selCmds = new Char_t*[selIterator->GetEntries()]; |
351 | mSelType = new AliEveTRDTrackListMacroType[selIterator->GetEntries()]; | |
352 | } | |
353 | ||
2670605d | 354 | Bool_t selectedByCorrSelMacro = kFALSE; |
c413e8d4 | 355 | |
8bdeb570 | 356 | AliEveTRDTrackListMacroType macroType = kUnknown; |
c413e8d4 | 357 | Int_t numHistoMacros = 0; |
358 | TH1** histos = 0; | |
caaf90d2 | 359 | |
e007877e | 360 | AliEveTRDTrack* track1 = 0; |
361 | AliEveTRDTrack* track2 = 0; | |
caaf90d2 | 362 | |
2670605d | 363 | // Collect the commands for each process macro and add them to "data-from-list" |
db16b708 | 364 | for (Int_t i = 0; i < procIterator->GetEntries(); i++){ |
2670605d | 365 | procCmds[i] = new Char_t[(fkMaxMacroPathNameLength + fkMaxApplyCommandLength)]; |
366 | memset(procCmds[i], '\0', sizeof(Char_t) * (fkMaxMacroNameLength + fkMaxApplyCommandLength)); | |
8e27fca1 | 367 | |
38a30030 | 368 | macro = (TMacroData*)fMacroList->GetValue(procIterator->At(i)->GetTitle()); |
e007877e | 369 | |
db16b708 | 370 | if (!macro){ |
38a30030 | 371 | Error("Apply process macros", |
db16b708 | 372 | Form("Macro list is corrupted: Macro \"%s\" is not registered!", |
373 | procIterator->At(i)->GetTitle())); | |
38a30030 | 374 | continue; |
e007877e | 375 | } |
38a30030 | 376 | |
377 | #ifdef ALIEVETRDTRACKLIST_DEBUG | |
378 | printf("AliEveTRDTrackList: Checking process macro: %s\n", macro->GetName()); | |
379 | #endif | |
380 | ||
381 | // Find the type of the process macro | |
382 | macroType = macro->GetType(); | |
db16b708 | 383 | if (macroType == kSingleTrackHisto || macroType == kCorrelTrackHisto){ |
2670605d | 384 | mProcType[i] = macroType; |
8bdeb570 | 385 | numHistoMacros++; |
386 | // Create the command | |
38a30030 | 387 | sprintf(procCmds[i], macro->GetCmd()); |
8bdeb570 | 388 | |
389 | // Add to "data-from-list" -> Mark as a histo macro with the substring "(histo macro)" | |
38a30030 | 390 | fDataFromMacroList->Add(new TObjString(Form("%s (histo macro)", macro->GetName()))); |
db16b708 | 391 | } else if (macroType == kSingleTrackAnalyse || macroType == kCorrelTrackAnalyse) { |
2670605d | 392 | mProcType[i] = macroType; |
c413e8d4 | 393 | // Create the command |
38a30030 | 394 | sprintf(procCmds[i], macro->GetCmd()); |
8bdeb570 | 395 | |
396 | // Add to "data-from-list" | |
38a30030 | 397 | fDataFromMacroList->Add(new TObjString(macro->GetName())); |
db16b708 | 398 | } else { |
8bdeb570 | 399 | Error("Apply process macros", |
db16b708 | 400 | Form("Macro list corrupted: Macro \"%s/%s.C\" is not registered as a process macro!", |
401 | macro->GetPath(), macro->GetName())); | |
2670605d | 402 | mProcType[i] = kUnknown; |
403 | } | |
404 | } | |
405 | ||
406 | // Collect the commands for each selection macro and add them to "data-from-list" | |
db16b708 | 407 | for (Int_t i = 0; i < selIterator->GetEntries(); i++){ |
2670605d | 408 | selCmds[i] = new Char_t[(fkMaxMacroPathNameLength + fkMaxApplyCommandLength)]; |
409 | memset(selCmds[i], '\0', sizeof(Char_t) * (fkMaxMacroNameLength + fkMaxApplyCommandLength)); | |
410 | ||
38a30030 | 411 | macro = (TMacroData*)fMacroList->GetValue(selIterator->At(i)->GetTitle()); |
412 | ||
db16b708 | 413 | if (!macro){ |
38a30030 | 414 | Error("Apply process macros", |
db16b708 | 415 | Form("Macro list is corrupted: Macro \"%s\" is not registered!", |
416 | selIterator->At(i)->GetTitle())); | |
38a30030 | 417 | continue; |
2670605d | 418 | } |
38a30030 | 419 | |
420 | #ifdef ALIEVETRDTRACKLIST_DEBUG | |
421 | printf("AliEveTRDTrackList: Checking selection macro: %s\n", macro->GetName()); | |
422 | #endif | |
2670605d | 423 | |
424 | // Find the type of the process macro | |
38a30030 | 425 | macroType = macro->GetType(); |
426 | ||
2670605d | 427 | // Single track select macro |
db16b708 | 428 | if (macroType == kSingleTrackSelect) { |
2670605d | 429 | // Has already been processed by ApplySTSelectionMacros(...) |
430 | mSelType[i] = macroType; | |
431 | } | |
432 | // Correlated tracks select macro | |
db16b708 | 433 | else if (macroType == kCorrelTrackSelect) { |
2670605d | 434 | mSelType[i] = macroType; |
435 | ||
436 | // Create the command | |
38a30030 | 437 | sprintf(selCmds[i], macro->GetCmd()); |
db16b708 | 438 | } else { |
2670605d | 439 | Error("Apply process macros", |
db16b708 | 440 | Form("Macro list corrupted: Macro \"%s/%s.C\" is not registered as a selection macro!", |
441 | macro->GetPath(), macro->GetName())); | |
38a30030 | 442 | mSelType[i] = kUnknown; |
c413e8d4 | 443 | } |
8e27fca1 | 444 | } |
c413e8d4 | 445 | |
446 | // Allocate memory for the histograms | |
447 | if (numHistoMacros > 0) histos = new TH1*[numHistoMacros]; | |
db16b708 | 448 | for (Int_t i = 0; i < numHistoMacros; i++) histos[i] = 0x0; |
38a30030 | 449 | |
caaf90d2 | 450 | |
db16b708 | 451 | ////////////////////////////////// |
452 | // WALK THROUGH THE LIST OF TRACKS | |
453 | ////////////////////////////////// | |
454 | for (TEveElement::List_i iter = this->BeginChildren(); iter != this->EndChildren(); ++iter){ | |
455 | if(!(track1 = dynamic_cast<AliEveTRDTrack*>(*iter))) continue; | |
456 | ||
caaf90d2 | 457 | // Skip tracks that have not been selected |
e007877e | 458 | if (!track1->GetRnrState()) continue; |
38a30030 | 459 | |
caaf90d2 | 460 | // Cast to AliTRDtrackV1 |
db16b708 | 461 | gROOT->ProcessLineSync(Form("AliEveTRDTrack *automaticTrack = (AliEveTRDTrack*)0x%xl;", track1)); |
e007877e | 462 | gROOT->ProcessLineSync("AliTRDtrackV1* automaticTrackV1_1 = (AliTRDtrackV1*)automaticTrack->GetUserData();"); |
caaf90d2 | 463 | |
464 | // Collect data for each macro | |
db16b708 | 465 | for (Int_t i = 0, histoIndex = 0; i < procIterator->GetEntries(); i++){ |
e007877e | 466 | // Single track histo |
db16b708 | 467 | if (mProcType[i] == kSingleTrackHisto){ |
468 | histos[histoIndex++] = (TH1*)gROOT->ProcessLineSync(procCmds[i]); | |
469 | // Correlated tracks histo | |
470 | } else if (mProcType[i] == kCorrelTrackHisto) { | |
e007877e | 471 | // Loop over all pairs behind the current one - together with the other loop this will be a loop |
472 | // over all pairs. We have a pair of tracks, if and only if both tracks of the pair are selected (Rnr-state) | |
473 | // and are not equal. | |
2670605d | 474 | // The correlated tracks process macro will applied to all pairs that will be additionally selected by |
475 | // all correlated tracks selection macros. | |
e007877e | 476 | TEveElement::List_i iter2 = iter; |
477 | iter2++; | |
478 | for ( ; iter2 != this->EndChildren(); ++iter2) | |
479 | { | |
db16b708 | 480 | if(!(track2 = dynamic_cast<AliEveTRDTrack*>(*iter2))) continue; |
e007877e | 481 | |
e007877e | 482 | // Skip tracks that have not been selected |
483 | if (!track2->GetRnrState()) continue; | |
484 | ||
e007877e | 485 | // Cast to AliTRDtrackV1 |
db16b708 | 486 | gROOT->ProcessLineSync(Form("AliEveTRDTrack *automaticTrack = (AliEveTRDTrack*)0x%xl;", track2)); |
e007877e | 487 | gROOT->ProcessLineSync("AliTRDtrackV1* automaticTrackV1_2 = (AliTRDtrackV1*)automaticTrack->GetUserData();"); |
488 | ||
2670605d | 489 | // Select track by default (so it will be processed, if there are no correlated tracks selection macros!) |
490 | selectedByCorrSelMacro = kTRUE; | |
db16b708 | 491 | for (Int_t j = 0; j < selIterator->GetEntries(); j++){ |
492 | if (mSelType[j] == kCorrelTrackSelect){ | |
2670605d | 493 | selectedByCorrSelMacro = (Bool_t)gROOT->ProcessLineSync(selCmds[j]); |
494 | if (!selectedByCorrSelMacro) break; | |
495 | } | |
496 | } | |
497 | ||
498 | // If the pair has not been selected by the correlated tracks selection macros, skip it! | |
499 | if (!selectedByCorrSelMacro) continue; | |
500 | ||
db16b708 | 501 | histos[histoIndex] = (TH1*)gROOT->ProcessLineSync(procCmds[i]); |
e007877e | 502 | } |
503 | histoIndex++; | |
504 | } | |
505 | // Single track analyse | |
db16b708 | 506 | else if (mProcType[i] == kSingleTrackAnalyse) { |
c413e8d4 | 507 | // Create data pointers in CINT, execute the macro and get the data |
508 | gROOT->ProcessLineSync("Double_t* results = 0;"); | |
509 | gROOT->ProcessLineSync("Int_t n = 0;"); | |
2670605d | 510 | gROOT->ProcessLineSync(procCmds[i]); |
c413e8d4 | 511 | Double_t* results = (Double_t*)gROOT->ProcessLineSync("results;"); |
512 | Int_t nResults = (Int_t)gROOT->ProcessLineSync("n;"); | |
513 | ||
db16b708 | 514 | if (results == 0) { |
2670605d | 515 | Error("Apply macros", Form("Error reading data from macro \"%s\"", procIterator->At(i)->GetTitle())); |
c413e8d4 | 516 | continue; |
517 | } | |
db16b708 | 518 | for (Int_t resInd = 0; resInd < nResults; resInd++){ |
c413e8d4 | 519 | (*fDataTree) << Form("TrackData%d", i) << Form("Macro%d=", i) << results[resInd] << (Char_t*)"\n"; |
520 | } | |
caaf90d2 | 521 | |
c413e8d4 | 522 | delete results; |
523 | results = 0; | |
524 | } | |
e007877e | 525 | // Correlated tracks analyse |
db16b708 | 526 | else if (mProcType[i] == kCorrelTrackAnalyse){ |
e007877e | 527 | // Loop over all pairs behind the current one - together with the other loop this will be a loop |
528 | // over all pairs. We have a pair of tracks, if and only if both tracks of the pair are selected (Rnr-state) | |
529 | // and are not equal. | |
2670605d | 530 | // The correlated tracks process macro will applied to all pairs that will be additionally selected by |
531 | // all correlated tracks selection macros. | |
e007877e | 532 | TEveElement::List_i iter2 = iter; |
533 | iter2++; | |
38a30030 | 534 | |
db16b708 | 535 | for ( ; iter2 != this->EndChildren(); ++iter2) { |
536 | if(!(track2 = dynamic_cast<AliEveTRDTrack*>(*iter2))) continue; | |
38a30030 | 537 | |
e007877e | 538 | // Skip tracks that have not been selected |
539 | if (!track2->GetRnrState()) continue; | |
38a30030 | 540 | |
e007877e | 541 | // Cast to AliTRDtrackV1 |
db16b708 | 542 | gROOT->ProcessLineSync(Form("AliEveTRDTrack *automaticTrack = (AliEveTRDTrack*)0x%xl;", track2)); |
e007877e | 543 | gROOT->ProcessLineSync("AliTRDtrackV1* automaticTrackV1_2 = (AliTRDtrackV1*)automaticTrack->GetUserData();"); |
544 | ||
2670605d | 545 | // Select track by default (so it will be processed, if there are no correlated tracks selection macros!) |
546 | selectedByCorrSelMacro = kTRUE; | |
db16b708 | 547 | for (Int_t j = 0; j < selIterator->GetEntries(); j++) { |
548 | if (mSelType[j] == kCorrelTrackSelect) { | |
2670605d | 549 | selectedByCorrSelMacro = (Bool_t)gROOT->ProcessLineSync(selCmds[j]); |
550 | if (!selectedByCorrSelMacro) break; | |
551 | } | |
552 | } | |
553 | ||
554 | // If the pair has not been selected by the correlated tracks selection macros, skip it! | |
555 | if (!selectedByCorrSelMacro) continue; | |
556 | ||
e007877e | 557 | // Create data pointers in CINT, execute the macro and get the data |
558 | gROOT->ProcessLineSync("Double_t* results = 0;"); | |
559 | gROOT->ProcessLineSync("Int_t n = 0;"); | |
2670605d | 560 | gROOT->ProcessLineSync(procCmds[i]); |
e007877e | 561 | Double_t* results = (Double_t*)gROOT->ProcessLineSync("results;"); |
562 | Int_t nResults = (Int_t)gROOT->ProcessLineSync("n;"); | |
38a30030 | 563 | |
db16b708 | 564 | if (results == 0) { |
2670605d | 565 | Error("Apply macros", Form("Error reading data from macro \"%s\"", procIterator->At(i)->GetTitle())); |
e007877e | 566 | continue; |
567 | } | |
db16b708 | 568 | for (Int_t resInd = 0; resInd < nResults; resInd++) { |
e007877e | 569 | (*fDataTree) << Form("TrackData%d", i) << Form("Macro%d=", i) << results[resInd] << (Char_t*)"\n"; |
570 | } | |
571 | ||
572 | delete results; | |
573 | results = 0; | |
574 | } | |
575 | } | |
caaf90d2 | 576 | } |
577 | } | |
caaf90d2 | 578 | |
db16b708 | 579 | for (Int_t i = 0, histoIndex = 0; i < procIterator->GetEntries() && histoIndex < numHistoMacros; i++) { |
580 | if (mProcType[i] == kSingleTrackHisto || mProcType[i] == kCorrelTrackHisto) { | |
5715955a | 581 | // Might be empty (e.g. no tracks have been selected)! |
db16b708 | 582 | if (histos[histoIndex]) { |
5715955a | 583 | (*fDataTree) << Form("TrackData%d", i) << Form("Macro%d=", i) << histos[histoIndex] << (Char_t*)"\n"; |
584 | } | |
585 | histoIndex++; | |
586 | } | |
c413e8d4 | 587 | } |
588 | ||
589 | if (fDataTree != 0) delete fDataTree; | |
caaf90d2 | 590 | fDataTree = 0; |
591 | ||
2670605d | 592 | if (procCmds != 0) delete [] procCmds; |
38a30030 | 593 | procCmds = 0; |
2670605d | 594 | if (mProcType != 0) delete mProcType; |
595 | mProcType = 0; | |
596 | ||
597 | if (selCmds != 0) delete [] selCmds; | |
38a30030 | 598 | selCmds = 0; |
2670605d | 599 | if (mSelType != 0) delete mSelType; |
600 | mSelType = 0; | |
c413e8d4 | 601 | |
602 | if (histos != 0) delete [] histos; | |
603 | histos = 0; | |
8e27fca1 | 604 | |
caaf90d2 | 605 | // Clear root |
db16b708 | 606 | // A.B. gROOT->Reset(); |
caaf90d2 | 607 | |
4f6473f6 | 608 | // If there is data, select the first data set |
2670605d | 609 | if (procIterator->GetEntries() > 0) SETBIT(fHistoDataSelected, 0); |
4f6473f6 | 610 | |
e007877e | 611 | // Now the data is stored in "/tmp/TRD.TrackListMacroData_$USER.root" |
caaf90d2 | 612 | // The editor will access this file to display the data |
ea24e1bc | 613 | return kTRUE; |
caaf90d2 | 614 | } |
615 | ||
8e27fca1 | 616 | //______________________________________________________ |
2670605d | 617 | void AliEveTRDTrackList::ApplySTSelectionMacros(const TList* iterator) |
caaf90d2 | 618 | { |
16db6074 | 619 | // Uses the iterator (for the selected selection macros) to apply the selected macros to the data. |
620 | // The rnr-states of the tracks are set according to the result of the macro calls (kTRUE, if all | |
621 | // macros return kTRUE for this track, otherwise: kFALSE). | |
2670605d | 622 | // "ST" stands for "single track". This means that only single track selection macros are applied. |
623 | // Correlated tracks selection macros will be used inside the call of ApplyProcessMacros(...)! | |
16db6074 | 624 | |
38a30030 | 625 | TMacroData* macro = 0; |
e007877e | 626 | AliEveTRDTrackListMacroType macroType = kUnknown; |
627 | AliEveTRDTrack* track1 = 0; | |
caaf90d2 | 628 | Bool_t selectedByMacro = kFALSE; |
629 | ||
630 | // Clear root | |
db16b708 | 631 | // A.B. gROOT->Reset(); |
caaf90d2 | 632 | |
4f6473f6 | 633 | // Select all tracks at first. A track is then deselect, if at least one selection macro |
634 | // returns kFALSE for this track | |
e007877e | 635 | // Enable all tracks (Note: EnableListElements(..) will call "ElementChanged", which will cause unforeseen behavior!) |
db16b708 | 636 | for (TEveElement::List_i iter = this->BeginChildren(); iter != this->EndChildren(); ++iter) ((TEveElement*)(*iter))->SetRnrState(kTRUE); |
4f6473f6 | 637 | SetRnrState(kTRUE); |
638 | ||
db16b708 | 639 | for (Int_t i = 0; i < iterator->GetEntries(); i++){ |
38a30030 | 640 | macro = (TMacroData*)fMacroList->GetValue(iterator->At(i)->GetTitle()); |
4f6473f6 | 641 | |
db16b708 | 642 | if (!macro){ |
38a30030 | 643 | Error("Apply selection macros", |
644 | Form("Macro list is corrupted: Macro \"%s\" is not registered!", iterator->At(i)->GetTitle())); | |
645 | continue; | |
646 | } | |
caaf90d2 | 647 | |
648 | #ifdef ALIEVETRDTRACKLIST_DEBUG | |
38a30030 | 649 | printf("AliEveTRDTrackList: Applying selection macro: %s\n", macro->GetName()); |
caaf90d2 | 650 | #endif |
caaf90d2 | 651 | |
e007877e | 652 | // Determine macro type |
38a30030 | 653 | macroType = macro->GetType(); |
caaf90d2 | 654 | |
e007877e | 655 | // Single track select macro |
db16b708 | 656 | if (macroType == kSingleTrackSelect){ |
e007877e | 657 | // Walk through the list of tracks |
658 | for (TEveElement::List_i iter = this->BeginChildren(); iter != this->EndChildren(); ++iter) | |
659 | { | |
660 | track1 = dynamic_cast<AliEveTRDTrack*>(*iter); | |
661 | ||
662 | if (!track1) continue; | |
663 | ||
664 | // If the track has already been deselected, nothing is to do here | |
665 | if (!track1->GetRnrState()) continue; | |
666 | ||
e007877e | 667 | // Cast to AliTRDtrackV1 |
db16b708 | 668 | gROOT->ProcessLineSync(Form("AliEveTRDTrack *automaticTrack = (AliEveTRDTrack*)0x%xl;", track1)); |
38a30030 | 669 | gROOT->ProcessLineSync("AliTRDtrackV1* automaticTrackV1_1 = (AliTRDtrackV1*)automaticTrack->GetUserData();"); |
670 | selectedByMacro = (Bool_t)gROOT->ProcessLineSync(macro->GetCmd()); | |
e007877e | 671 | track1->SetRnrState(selectedByMacro && track1->GetRnrState()); |
672 | } | |
673 | } | |
674 | // Correlated tracks select macro | |
db16b708 | 675 | else if (macroType == kCorrelTrackSelect){ |
2670605d | 676 | // Will be processed in ApplyProcessMacros(...) |
677 | continue; | |
db16b708 | 678 | } else { |
e007877e | 679 | Error("Apply selection macros", |
db16b708 | 680 | Form("Macro list corrupted: Macro \"%s/%s.C\" is not registered as a selection macro!", |
681 | macro->GetPath(), macro->GetName())); | |
e007877e | 682 | } |
caaf90d2 | 683 | } |
684 | ||
685 | // Clear root | |
db16b708 | 686 | // A.B. gROOT->Reset(); |
caaf90d2 | 687 | } |
688 | ||
8bdeb570 | 689 | //______________________________________________________ |
38a30030 | 690 | AliEveTRDTrackList::AliEveTRDTrackListMacroType AliEveTRDTrackList::GetMacroType(const Char_t* name, Bool_t UseList) const |
8bdeb570 | 691 | { |
38a30030 | 692 | // Returns the type of the corresponding macro. |
16db6074 | 693 | // If "UseList" is kTRUE, the type will be looked up in the internal list (very fast). But if this list |
694 | // does not exist, you have to use kFALSE for this parameter. Then the type will be determined by the | |
695 | // prototype! NOTE: It is assumed that the macro has been compiled! If not, the return value is not | |
696 | // predictable, but normally will be kUnknown. | |
38a30030 | 697 | // Note: AddMacro(Fast) will update the internal list and RemoveMacros respectively. |
16db6074 | 698 | |
8bdeb570 | 699 | AliEveTRDTrackListMacroType type = kUnknown; |
700 | ||
38a30030 | 701 | // Re-do the check of the macro type |
db16b708 | 702 | if (!UseList){ |
e007877e | 703 | // Single track select macro or single track histo macro? |
8bdeb570 | 704 | TFunction* f = gROOT->GetGlobalFunctionWithPrototype(name, "const AliTRDtrackV1*", kTRUE); |
705 | if (f != 0x0) | |
706 | { | |
707 | // Some additional check (is the parameter EXACTLY of the desired type?) | |
708 | if (strstr(f->GetMangledName(), "oPconstsPAliTRDtrackV1mUsP") != 0x0) | |
709 | { | |
e007877e | 710 | // Single track select macro? |
8bdeb570 | 711 | if (!strcmp(f->GetReturnTypeName(), "Bool_t")) |
712 | { | |
e007877e | 713 | type = kSingleTrackSelect; |
8bdeb570 | 714 | } |
e007877e | 715 | // single track histo macro? |
8bdeb570 | 716 | else if (!strcmp(f->GetReturnTypeName(), "TH1*")) |
717 | { | |
e007877e | 718 | type = kSingleTrackHisto; |
8bdeb570 | 719 | } |
720 | } | |
721 | } | |
e007877e | 722 | // Single track analyse macro? |
8bdeb570 | 723 | else if ((f = gROOT->GetGlobalFunctionWithPrototype(name, "const AliTRDtrackV1*, Double_t*&, Int_t&", kTRUE)) |
724 | != 0x0) | |
725 | { | |
726 | if (!strcmp(f->GetReturnTypeName(), "void")) | |
727 | { | |
728 | // Some additional check (are the parameters EXACTLY of the desired type?) | |
729 | if (strstr(f->GetMangledName(), "oPconstsPAliTRDtrackV1mUsP") != 0x0 && | |
730 | strstr(f->GetMangledName(), "cODouble_tmUaNsP") != 0x0 && | |
731 | strstr(f->GetMangledName(), "cOInt_taNsP") != 0x0) | |
732 | { | |
e007877e | 733 | type = kSingleTrackAnalyse; |
734 | } | |
735 | } | |
736 | } | |
737 | // Correlated tracks select macro or correlated tracks histo macro? | |
738 | else if ((f = gROOT->GetGlobalFunctionWithPrototype(name, "const AliTRDtrackV1*, const AliTRDtrackV1*", kTRUE)) | |
739 | != 0x0) | |
740 | { | |
741 | // Some additional check (is the parameter EXACTLY of the desired type?) | |
742 | if (strstr(f->GetMangledName(), "oPconstsPAliTRDtrackV1mUsP") != 0x0 && | |
743 | strstr(f->GetMangledName(), "cOconstsPAliTRDtrackV1mUsP") != 0x0) | |
744 | { | |
745 | // Single track select macro? | |
746 | if (!strcmp(f->GetReturnTypeName(), "Bool_t")) | |
747 | { | |
748 | type = kCorrelTrackSelect; | |
749 | } | |
750 | // single track histo macro? | |
751 | else if (!strcmp(f->GetReturnTypeName(), "TH1*")) | |
752 | { | |
753 | type = kCorrelTrackHisto; | |
754 | } | |
755 | } | |
756 | } | |
757 | // Correlated tracks analyse macro? | |
758 | else if ((f = gROOT->GetGlobalFunctionWithPrototype(name, | |
759 | "const AliTRDtrackV1*, const AliTRDtrackV1*, Double_t*&, Int_t&", kTRUE)) | |
760 | != 0x0) | |
761 | { | |
762 | if (!strcmp(f->GetReturnTypeName(), "void")) | |
763 | { | |
764 | // Some additional check (is the parameter EXACTLY of the desired type?) | |
765 | if (strstr(f->GetMangledName(), "oPconstsPAliTRDtrackV1mUsP") != 0x0 && | |
766 | strstr(f->GetMangledName(), "cOconstsPAliTRDtrackV1mUsP") != 0x0 && | |
767 | strstr(f->GetMangledName(), "cODouble_tmUaNsP") != 0x0 && | |
768 | strstr(f->GetMangledName(), "cOInt_taNsP") != 0x0) | |
769 | { | |
770 | type = kCorrelTrackAnalyse; | |
8bdeb570 | 771 | } |
772 | } | |
773 | } | |
774 | } | |
775 | // Use list to look up the macro type | |
776 | else | |
777 | { | |
38a30030 | 778 | TMacroData* macro = 0; |
779 | macro = (TMacroData*)fMacroList->GetValue(name); | |
780 | if (macro == 0) return kUnknown; | |
8bdeb570 | 781 | |
38a30030 | 782 | type = macro->GetType(); |
8bdeb570 | 783 | switch (type) |
784 | { | |
e007877e | 785 | case kSingleTrackSelect: |
786 | case kSingleTrackAnalyse: | |
787 | case kSingleTrackHisto: | |
788 | case kCorrelTrackSelect: | |
789 | case kCorrelTrackAnalyse: | |
790 | case kCorrelTrackHisto: | |
8bdeb570 | 791 | break; |
792 | default: | |
793 | type = kUnknown; | |
794 | break; | |
795 | } | |
796 | } | |
797 | ||
798 | return type; | |
799 | } | |
800 | ||
8e27fca1 | 801 | //______________________________________________________ |
38a30030 | 802 | void AliEveTRDTrackList::RemoveSelectedMacros(const TList* iterator) |
caaf90d2 | 803 | { |
38a30030 | 804 | // Uses the iterator (for the selected macros) to remove the selected macros from |
16db6074 | 805 | // the corresponding list. |
806 | ||
38a30030 | 807 | TObject* key = 0; |
808 | TPair* entry = 0; | |
caaf90d2 | 809 | for (Int_t i = 0; i < iterator->GetEntries(); i++) |
810 | { | |
38a30030 | 811 | entry = (TPair*)fMacroList->FindObject(iterator->At(i)->GetTitle()); |
8bdeb570 | 812 | |
38a30030 | 813 | if (entry == 0) |
814 | { | |
815 | Error("AliEveTRDTrackList::RemoveSelectedMacros", Form("Macro \"%s\" not found in list!", | |
816 | iterator->At(i)->GetTitle())); | |
817 | continue; | |
818 | } | |
819 | key = entry->Key(); | |
caaf90d2 | 820 | |
38a30030 | 821 | if (key == 0) |
822 | { | |
823 | Error("AliEveTRDTrackList::RemoveSelectedMacros", Form("Key for macro \"%s\" not found in list!", | |
824 | iterator->At(i)->GetTitle())); | |
825 | continue; | |
826 | } | |
827 | ||
828 | // Key and value will be deleted, too, since fMacroList is the owner of them | |
829 | Bool_t rem = fMacroList->DeleteEntry(key); | |
8bdeb570 | 830 | |
38a30030 | 831 | if (rem) |
832 | { | |
833 | #ifdef ALIEVETRDTRACKLIST_DEBUG | |
834 | printf("AliEveTRDTrackList::RemoveSelectedMacros(): Removed macro: %s\n", iterator->At(i)->GetTitle()); | |
835 | #endif | |
836 | } | |
837 | else | |
838 | { | |
839 | Error("AliEveTRDTrackList::RemoveSelectedMacros", Form("Macro \"%s\" could not be removed from the list!", | |
840 | iterator->At(i)->GetTitle())); | |
841 | } | |
caaf90d2 | 842 | } |
2ef0687e | 843 | } |
4f6473f6 | 844 | |
ecbbe371 | 845 | //______________________________________________________ |
846 | void AliEveTRDTrackList::UpdateTrackStyle(AliEveTRDTrack::AliEveTRDTrackState s, UChar_t ss) | |
847 | { | |
16db6074 | 848 | // Updates the track style and sets this style for each track. |
849 | ||
8bdeb570 | 850 | switch(s) |
851 | { | |
e007877e | 852 | case AliEveTRDTrack::kSource: |
853 | SETBIT(fSelectedStyle, AliEveTRDTrack::kSource); | |
854 | break; | |
855 | case AliEveTRDTrack::kPID: | |
856 | CLRBIT(fSelectedStyle, AliEveTRDTrack::kSource); | |
857 | switch(ss) | |
858 | { | |
9443fb9d | 859 | case AliTRDpidUtil::kLQ: |
e007877e | 860 | CLRBIT(fSelectedStyle, AliEveTRDTrack::kPID); |
861 | break; | |
9443fb9d | 862 | case AliTRDpidUtil::kNN: |
e007877e | 863 | SETBIT(fSelectedStyle, AliEveTRDTrack::kPID); |
864 | break; | |
865 | } | |
866 | break; | |
867 | case AliEveTRDTrack::kTrackCosmics: | |
868 | SETBIT(fSelectedStyle, AliEveTRDTrack::kTrackCosmics); | |
869 | break; | |
870 | case AliEveTRDTrack::kTrackModel: | |
871 | CLRBIT(fSelectedStyle, AliEveTRDTrack::kTrackCosmics); | |
872 | switch(ss) | |
873 | { | |
874 | case AliEveTRDTrack::kRieman: | |
875 | CLRBIT(fSelectedStyle, AliEveTRDTrack::kTrackModel); | |
876 | break; | |
877 | case AliEveTRDTrack::kKalman: | |
12896fe5 | 878 | //AliWarning("Kalman fit under testing for the moment."); |
879 | SETBIT(fSelectedStyle, AliEveTRDTrack::kTrackModel); | |
e007877e | 880 | break; |
881 | } | |
882 | break; | |
ecbbe371 | 883 | } |
884 | ||
885 | ||
ecbbe371 | 886 | // Walk through the list of tracks |
887 | AliEveTRDTrack* track = 0x0; | |
8bdeb570 | 888 | for (TEveElement::List_i iter = this->BeginChildren(); iter != this->EndChildren(); ++iter) |
889 | { | |
ecbbe371 | 890 | if (!(track = dynamic_cast<AliEveTRDTrack*>(*iter))) continue; |
891 | ||
892 | track->SetStatus(fSelectedStyle); | |
893 | } | |
894 | } |