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