]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVE/EveDet/AliEveTRDTrackList.cxx
fix user histogram management and style (Ben)
[u/mrichter/AliRoot.git] / EVE / EveDet / AliEveTRDTrackList.cxx
index 2e48d614e3e417d79f0d29e00e6772818a79b278..61f55e1a446641acc64ffea9e87b886e67e3f75b 100644 (file)
@@ -1,10 +1,11 @@
-// Author: Benjamin Hess   25/09/2008
+// Author: Benjamin Hess   29/01/2010
 
 /*************************************************************************
- * Copyright (C) 2008, Alexandru Bercuci, Benjamin Hess.                 *
+ * Copyright (C) 2009-2010, Alexandru Bercuci, Benjamin Hess.            *
  * All rights reserved.                                                  *
  *************************************************************************/
 
+
 //////////////////////////////////////////////////////////////////////////
 //                                                                      //
 // AliEveTRDTrackList                                                   //
 // Uncomment to display debugging infos
 //#define ALIEVETRDTRACKLIST_DEBUG
 
-#include "AliEveTRDTrackList.h"
-
-#include <EveDet/AliEveTRDTrackListEditor.h>
-#include <AliTRDReconstructor.h>
 #include <TFile.h>
 #include <TFunction.h>
 #include <TH1.h>
 #include <TSystem.h>
 #include <TTree.h>
 #include <TTreeStream.h>
+#include <TMethodCall.h>
+
+#include <AliTRDReconstructor.h>
+
+#include <EveDet/AliEveTRDTrackList.h>
+#include <EveDet/AliEveTRDTrackListEditor.h>
+
+#include <../PWG1/TRD/AliTRDrecoTask.h>
+#include <../PWG1/TRD/macros/AliTRDperformanceTrain.h>
 
 ClassImp(AliEveTRDTrackList)
 
@@ -107,7 +113,7 @@ AliEveTRDTrackList::AliEveTRDTrackList(const Text_t* n, const Text_t* t, Bool_t
   if(gSystem->AccessPathName(Form("%s/.trdQArec" , gSystem->Getenv("HOME")))) gSystem->Exec("mkdir $HOME/.trdQArec");
   gSystem->SetBuildDir(Form("%s/.trdQArec", gSystem->Getenv("HOME")));
 
-  AddStandardMacros();
+  AddStandardContent();
 }
 
 //______________________________________________________
@@ -178,39 +184,33 @@ Int_t AliEveTRDTrackList::AddMacro(const Char_t* path, const Char_t* nameC, Bool
   for (UInt_t ind = 0; ind < fkMaxMacroNameLength && ind < strlen(nameC) - 2; ind++)  name[ind] = nameC[ind];
 
   // Check, if files exists
-  FILE* fp = 0;
-
-  fp = fopen(pathname, "rb");
-  if (fp != 0)
-  {
+  FILE* fp = 0x0;
+  if((fp = fopen(pathname, "rb"))){
     fclose(fp);
-    fp = 0;
-  }
-  else  return NOT_EXIST_ERROR;
+    fp = 0x0;
+  } else  return NOT_EXIST_ERROR;
   
   // Clean up root, load the desired macro and then check the type of the macro
-  gROOT->Reset();
+  // A.B. gROOT->Reset();
  
-  if (forceReload)  gROOT->ProcessLineSync(Form(".L %s++", pathname));
-  else              gROOT->ProcessLineSync(Form(".L %s+", pathname));
+  gROOT->ProcessLineSync(Form(".L %s+%c", pathname, forceReload ? '+' : ' '));
+
+  // We need this line... otherwise, in some cases, there will be problems concerning ACLIC
+  gROOT->ProcessLineSync(Form(".L %s", pathname));
 
   AliEveTRDTrackListMacroType type = GetMacroType(name, kFALSE);
 
   // Clean up again
-  gROOT->Reset();
+  // A.B. gROOT->Reset();
   
   // Has not the correct signature!
   if (type == kUnknown)  return SIGNATURE_ERROR;
 
-  Int_t returnValue = WARNING;
-
   // Only add macro, if it is not already in the list
-  if (fMacroList->GetValue(name) == 0)
-  {
-    if (AddMacroFast(path, name, type)) returnValue = SUCCESS;
-    else                                returnValue = WARNING;
+  Int_t returnValue = WARNING;
+  if(fMacroList->GetValue(name) == 0) {
+    returnValue = AddMacroFast(path, name, type) ? SUCCESS : ERROR;
   }
-
   return returnValue;
 }
 
@@ -260,7 +260,7 @@ Bool_t AliEveTRDTrackList::AddMacroFast(const Char_t* path, const Char_t* name,
 }
 
 //______________________________________________________
-void AliEveTRDTrackList::AddStandardMacros()
+void AliEveTRDTrackList::AddStandardContent()
 {
   // Adds standard macros to the macro list.
 
@@ -270,10 +270,39 @@ void AliEveTRDTrackList::AddStandardMacros()
   // -> If the file does not exist, nothing happens. So if you want to handle this,
   // use the return value of AddMacro (NOT_EXIST_ERROR is returned, if file does not exist)
   // (-> You can also check for other return values (see AddMacro(...)))
-  AddMacro("$(ALICE_ROOT)/TRD/qaRec/macros", "clusterSelection.C");
-  AddMacro("$(ALICE_ROOT)/TRD/qaRec/macros", "chargeDistr.C");
-  AddMacro("$(ALICE_ROOT)/TRD/qaRec/macros", "clusterResiduals.C");
-  AddMacro("$(ALICE_ROOT)/TRD/qaRec/macros", "PH.C");
+
+  const Char_t *libs[] = {"libANALYSIS.so", "libANALYSISalice.so", "libTENDER.so", "libPWG1.so"};
+  Int_t nlibs = static_cast<Int_t>(sizeof(libs)/sizeof(Char_t *));
+  for(Int_t ilib=0; ilib<nlibs; ilib++){
+    if(gSystem->Load(libs[ilib]) >= 0) continue;
+    AliError(Form("Fail loading %s.", libs[ilib]));
+    return;
+  }
+
+  AliTRDrecoTask *task = 0x0;
+  TList *fPlots = 0x0;
+  for(Int_t it=2; it<NTRDQATASKS; it++){
+    TClass c(fgkTRDtaskClassName[it]);
+    task = (AliTRDrecoTask*)c.New();
+    task->SetMCdata(kFALSE);
+    if(!(fPlots = task->GetPlotFunctors())){
+      //AliWarning(Form("No Plot functors defined for task \"%s\"", fgkTRDtaskClassName[it]));
+      delete task;
+      continue;
+    }
+    if(!(task->Histos())){
+      //AliWarning(Form("No Ref Histograms defined for task \"%s\"", fgkTRDtaskClassName[it]));
+      delete task;
+      continue;
+    }
+
+    // export task to CINT and add functions
+    gROOT->ProcessLine(Form("%s* %s = (%s*)0x%lx;", fgkTRDtaskClassName[it], task->GetName(), fgkTRDtaskClassName[it], (void*)task));
+    TIter iter(fPlots); TMethodCall *m = 0x0;
+    while((m = dynamic_cast<TMethodCall*>(iter()))){
+      AddMacroFast("", Form("%s->%s", task->GetName(), m->GetMethodName()), kSingleTrackHisto);
+    }
+  }
 }
 
 //______________________________________________________
@@ -292,20 +321,20 @@ Bool_t AliEveTRDTrackList::ApplyProcessMacros(const TList* selIterator, const TL
   if (procIterator->GetEntries() <= 0)  return kTRUE;
 
   // Clear root
-  gROOT->Reset();
+  // A.B. gROOT->Reset();
   
   // Clear old data and re-allocate
-  if (fDataTree == 0) fDataTree = new TTreeSRedirector(Form("/tmp/TRD.TrackListMacroData_%s.root", 
-                                                            gSystem->Getenv("USER")));
-  if (!fDataTree)
-  {
-    Error("Apply process macros", Form("File \"/tmp/TRD.TrackListMacroData_%s.root\" could not be accessed properly!", 
-                                       gSystem->Getenv("USER")));
+  if (fDataTree == 0x0){ 
+    TDirectory *cwd = gDirectory;
+    fDataTree = new TTreeSRedirector(Form("/tmp/TRD.TrackListMacroData_%s.root", gSystem->Getenv("USER")));
+    cwd->cd();
+  }
+  if (!fDataTree){
+    Error("Apply process macros", Form("File \"/tmp/TRD.TrackListMacroData_%s.root\" could not be accessed properly!", gSystem->Getenv("USER")));
     return kFALSE;
   }
   
-  if (fDataFromMacroList != 0)
-  {
+  if (fDataFromMacroList != 0) {
     fDataFromMacroList->Delete();
     delete fDataFromMacroList;
   }
@@ -319,16 +348,14 @@ Bool_t AliEveTRDTrackList::ApplyProcessMacros(const TList* selIterator, const TL
 
   Char_t** procCmds = 0;
   AliEveTRDTrackListMacroType* mProcType = 0;
-  if (procIterator->GetEntries() > 0) 
-  {
+  if (procIterator->GetEntries() > 0) {
     procCmds = new Char_t*[procIterator->GetEntries()];
     mProcType = new AliEveTRDTrackListMacroType[procIterator->GetEntries()];
   }
 
   Char_t** selCmds  = 0;
   AliEveTRDTrackListMacroType* mSelType = 0;
-  if (selIterator->GetEntries() > 0) 
-  {
+  if (selIterator->GetEntries() > 0) {
     selCmds = new Char_t*[selIterator->GetEntries()];
     mSelType = new AliEveTRDTrackListMacroType[selIterator->GetEntries()];
   }
@@ -341,20 +368,18 @@ Bool_t AliEveTRDTrackList::ApplyProcessMacros(const TList* selIterator, const TL
 
   AliEveTRDTrack* track1 = 0;
   AliEveTRDTrack* track2 = 0;
-  TH1* returnedHist = 0x0;
 
   // Collect the commands for each process macro and add them to "data-from-list"
-  for (Int_t i = 0; i < procIterator->GetEntries(); i++)
-  {
+  for (Int_t i = 0; i < procIterator->GetEntries(); i++){
     procCmds[i] = new Char_t[(fkMaxMacroPathNameLength + fkMaxApplyCommandLength)];
     memset(procCmds[i], '\0', sizeof(Char_t) * (fkMaxMacroNameLength + fkMaxApplyCommandLength));
 
     macro = (TMacroData*)fMacroList->GetValue(procIterator->At(i)->GetTitle());
 
-    if (!macro)
-    {
+    if (!macro){
       Error("Apply process macros", 
-            Form("Macro list is corrupted: Macro \"%s\" is not registered!", procIterator->At(i)->GetTitle()));
+        Form("Macro list is corrupted: Macro \"%s\" is not registered!", 
+        procIterator->At(i)->GetTitle()));
       continue;
     }
 
@@ -364,8 +389,7 @@ Bool_t AliEveTRDTrackList::ApplyProcessMacros(const TList* selIterator, const TL
            
     // Find the type of the process macro
     macroType = macro->GetType();
-    if (macroType == kSingleTrackHisto || macroType == kCorrelTrackHisto)
-    {
+    if (macroType == kSingleTrackHisto || macroType == kCorrelTrackHisto){
       mProcType[i] = macroType;
       numHistoMacros++;
       // Create the command 
@@ -373,37 +397,32 @@ Bool_t AliEveTRDTrackList::ApplyProcessMacros(const TList* selIterator, const TL
 
       // Add to "data-from-list" -> Mark as a histo macro with the substring "(histo macro)"
       fDataFromMacroList->Add(new TObjString(Form("%s (histo macro)", macro->GetName())));
-    }
-    else if (macroType == kSingleTrackAnalyse || macroType == kCorrelTrackAnalyse)
-    {
+    } else if (macroType == kSingleTrackAnalyse || macroType == kCorrelTrackAnalyse) {
       mProcType[i] = macroType;
       // Create the command 
       sprintf(procCmds[i], macro->GetCmd());
 
       // Add to "data-from-list"
       fDataFromMacroList->Add(new TObjString(macro->GetName()));
-    }
-    else
-    {
+    } else {
       Error("Apply process macros", 
-            Form("Macro list corrupted: Macro \"%s/%s.C\" is not registered as a process macro!", 
-                 macro->GetPath(), macro->GetName()));
+        Form("Macro list corrupted: Macro \"%s/%s.C\" is not registered as a process macro!", 
+        macro->GetPath(), macro->GetName()));
       mProcType[i] = kUnknown;
     } 
   }  
 
   // Collect the commands for each selection macro and add them to "data-from-list"
-  for (Int_t i = 0; i < selIterator->GetEntries(); i++)
-  {
+  for (Int_t i = 0; i < selIterator->GetEntries(); i++){
     selCmds[i] = new Char_t[(fkMaxMacroPathNameLength + fkMaxApplyCommandLength)];
     memset(selCmds[i], '\0', sizeof(Char_t) * (fkMaxMacroNameLength + fkMaxApplyCommandLength));
 
     macro = (TMacroData*)fMacroList->GetValue(selIterator->At(i)->GetTitle());
 
-    if (!macro)
-    {
+    if (!macro){
       Error("Apply process macros", 
-            Form("Macro list is corrupted: Macro \"%s\" is not registered!", selIterator->At(i)->GetTitle()));
+        Form("Macro list is corrupted: Macro \"%s\" is not registered!", 
+        selIterator->At(i)->GetTitle()));
       continue;
     }
 
@@ -415,94 +434,71 @@ Bool_t AliEveTRDTrackList::ApplyProcessMacros(const TList* selIterator, const TL
     macroType = macro->GetType();
 
     // Single track select macro
-    if (macroType == kSingleTrackSelect)
-    {
+    if (macroType == kSingleTrackSelect) {
       // Has already been processed by ApplySTSelectionMacros(...)
       mSelType[i] = macroType;         
     }
     // Correlated tracks select macro
-    else if (macroType == kCorrelTrackSelect)
-    {
+    else if (macroType == kCorrelTrackSelect) {
       mSelType[i] = macroType;  
  
       // Create the command
       sprintf(selCmds[i], macro->GetCmd());
-    }
-    else
-    {
+    } else {
       Error("Apply process macros", 
-            Form("Macro list corrupted: Macro \"%s/%s.C\" is not registered as a selection macro!", 
-                 macro->GetPath(), macro->GetName()));
+        Form("Macro list corrupted: Macro \"%s/%s.C\" is not registered as a selection macro!", 
+        macro->GetPath(), macro->GetName()));
       mSelType[i] = kUnknown;
     } 
   }  
 
   // Allocate memory for the histograms
   if (numHistoMacros > 0)  histos = new TH1*[numHistoMacros];
-  for (Int_t i = 0; i < numHistoMacros; i++)  histos[i] = 0;
+  for (Int_t i = 0; i < numHistoMacros; i++)  histos[i] = 0x0;
 
-  // Walk through the list of tracks     
-  for (TEveElement::List_i iter = this->BeginChildren(); iter != this->EndChildren(); ++iter)
-  {
-    track1 = dynamic_cast<AliEveTRDTrack*>(*iter);
 
-    if (!track1)  continue;
-  
+  //////////////////////////////////
+  // WALK THROUGH THE LIST OF TRACKS
+  //////////////////////////////////     
+  for (TEveElement::List_i iter = this->BeginChildren(); iter != this->EndChildren(); ++iter){
+    if(!(track1 = dynamic_cast<AliEveTRDTrack*>(*iter))) continue;
+
     // Skip tracks that have not been selected
     if (!track1->GetRnrState())  continue;
     
-    track1->ExportToCINT((Text_t*)"automaticTrack");
     // Cast to AliTRDtrackV1
+    gROOT->ProcessLineSync(Form("AliEveTRDTrack *automaticTrack = (AliEveTRDTrack*)0x%xl;", track1));
     gROOT->ProcessLineSync("AliTRDtrackV1* automaticTrackV1_1 = (AliTRDtrackV1*)automaticTrack->GetUserData();");
 
     // Collect data for each macro
-    for (Int_t i = 0, histoIndex = 0; i < procIterator->GetEntries(); i++)
-    {
+    for (Int_t i = 0, histoIndex = 0; i < procIterator->GetEntries(); i++){
       // Single track histo
-      if (mProcType[i] == kSingleTrackHisto)
-      {
-        returnedHist = (TH1*)gROOT->ProcessLineSync(procCmds[i]);
-        if (returnedHist != 0x0)
-        {
-          if (histos[histoIndex] == 0)  histos[histoIndex] = returnedHist;
-          else  
-          {
-            histos[histoIndex]->Add((const TH1*)returnedHist);
-            delete returnedHist;
-            returnedHist = 0;
-          }
-        }
-        histoIndex++;
-      }
-      // Correlated tracks histo
-      else if (mProcType[i] == kCorrelTrackHisto)
-      {
+      if (mProcType[i] == kSingleTrackHisto){
+        histos[histoIndex++] = (TH1*)gROOT->ProcessLineSync(procCmds[i]);
+       // Correlated tracks histo
+      } else if (mProcType[i] == kCorrelTrackHisto) {
         // Loop over all pairs behind the current one - together with the other loop this will be a loop
         // over all pairs. We have a pair of tracks, if and only if both tracks of the pair are selected (Rnr-state)
         // and are not equal.
-        // The correlated tracks process macro will applied to all pairs that will be additionally selected by
+        // The correlated tracks process macro will be applied to all pairs that will be additionally selected by
         // all correlated tracks selection macros.
         TEveElement::List_i iter2 = iter;
         iter2++;
         for ( ; iter2 != this->EndChildren(); ++iter2)
         {
-          track2 = dynamic_cast<AliEveTRDTrack*>(*iter2);
+          if(!(track2 = dynamic_cast<AliEveTRDTrack*>(*iter2))) continue;
 
-          if (!track2)  continue;
-    
           // Skip tracks that have not been selected
           if (!track2->GetRnrState())  continue;
       
-          track2->ExportToCINT((Text_t*)"automaticTrack");
           // Cast to AliTRDtrackV1
+          gROOT->ProcessLineSync(Form("AliEveTRDTrack *automaticTrack = (AliEveTRDTrack*)0x%xl;", track2));
           gROOT->ProcessLineSync("AliTRDtrackV1* automaticTrackV1_2 = (AliTRDtrackV1*)automaticTrack->GetUserData();");
 
           // Select track by default (so it will be processed, if there are no correlated tracks selection macros!)
           selectedByCorrSelMacro = kTRUE;
-          for (Int_t j = 0; j < selIterator->GetEntries(); j++)
-          {
-            if (mSelType[j] == kCorrelTrackSelect)
-            {
+          for (Int_t j = 0; j < selIterator->GetEntries(); j++){
+            if (mSelType[j] == kCorrelTrackSelect){
               selectedByCorrSelMacro = (Bool_t)gROOT->ProcessLineSync(selCmds[j]);
               if (!selectedByCorrSelMacro)  break;
             }
@@ -511,24 +507,12 @@ Bool_t AliEveTRDTrackList::ApplyProcessMacros(const TList* selIterator, const TL
           // If the pair has not been selected by the correlated tracks selection macros, skip it!
           if (!selectedByCorrSelMacro) continue;
           
-          returnedHist = (TH1*)gROOT->ProcessLineSync(procCmds[i]);
-          if (returnedHist != 0x0)
-          {
-            if (histos[histoIndex] == 0)  histos[histoIndex] = returnedHist;
-            else  
-            {
-              histos[histoIndex]->Add((const TH1*)returnedHist);
-
-              delete returnedHist;
-              returnedHist = 0;
-            }
-          }
+          histos[histoIndex] = (TH1*)gROOT->ProcessLineSync(procCmds[i]);
         }
         histoIndex++;
       }
       // Single track analyse
-      else if (mProcType[i] == kSingleTrackAnalyse)
-      {
+      else if (mProcType[i] == kSingleTrackAnalyse) {
         // Create data pointers in CINT, execute the macro and get the data
         gROOT->ProcessLineSync("Double_t* results = 0;");
         gROOT->ProcessLineSync("Int_t n = 0;");
@@ -536,13 +520,11 @@ Bool_t AliEveTRDTrackList::ApplyProcessMacros(const TList* selIterator, const TL
         Double_t* results = (Double_t*)gROOT->ProcessLineSync("results;");
         Int_t nResults = (Int_t)gROOT->ProcessLineSync("n;");
         
-        if (results == 0)
-        {
+        if (results == 0) {
           Error("Apply macros", Form("Error reading data from macro \"%s\"", procIterator->At(i)->GetTitle()));
           continue;
         }
-        for (Int_t resInd = 0; resInd < nResults; resInd++)
-        {
+        for (Int_t resInd = 0; resInd < nResults; resInd++){
           (*fDataTree) << Form("TrackData%d", i) << Form("Macro%d=", i) << results[resInd] << (Char_t*)"\n";   
         }
 
@@ -550,35 +532,29 @@ Bool_t AliEveTRDTrackList::ApplyProcessMacros(const TList* selIterator, const TL
         results = 0;
       }
       // Correlated tracks analyse
-      else if (mProcType[i] == kCorrelTrackAnalyse)
-      {
+      else if (mProcType[i] == kCorrelTrackAnalyse){
         // Loop over all pairs behind the current one - together with the other loop this will be a loop
         // over all pairs. We have a pair of tracks, if and only if both tracks of the pair are selected (Rnr-state)
         // and are not equal.
-        // The correlated tracks process macro will applied to all pairs that will be additionally selected by
+        // The correlated tracks process macro will be applied to all pairs that will be additionally selected by
         // all correlated tracks selection macros.
         TEveElement::List_i iter2 = iter;
         iter2++;
 
-        for ( ; iter2 != this->EndChildren(); ++iter2)
-        {
-          track2 = dynamic_cast<AliEveTRDTrack*>(*iter2);
-
-          if (!track2)  continue;
+        for ( ; iter2 != this->EndChildren(); ++iter2) {
+          if(!(track2 = dynamic_cast<AliEveTRDTrack*>(*iter2))) continue;
  
           // Skip tracks that have not been selected
           if (!track2->GetRnrState())  continue;
     
-          track2->ExportToCINT((Text_t*)"automaticTrack");
           // Cast to AliTRDtrackV1
+          gROOT->ProcessLineSync(Form("AliEveTRDTrack *automaticTrack = (AliEveTRDTrack*)0x%xl;", track2));
           gROOT->ProcessLineSync("AliTRDtrackV1* automaticTrackV1_2 = (AliTRDtrackV1*)automaticTrack->GetUserData();");
 
           // Select track by default (so it will be processed, if there are no correlated tracks selection macros!)
           selectedByCorrSelMacro = kTRUE;
-          for (Int_t j = 0; j < selIterator->GetEntries(); j++)
-          {
-            if (mSelType[j] == kCorrelTrackSelect)
-            {
+          for (Int_t j = 0; j < selIterator->GetEntries(); j++) {
+            if (mSelType[j] == kCorrelTrackSelect) {
               selectedByCorrSelMacro = (Bool_t)gROOT->ProcessLineSync(selCmds[j]);
               if (!selectedByCorrSelMacro)  break;
             }
@@ -594,13 +570,11 @@ Bool_t AliEveTRDTrackList::ApplyProcessMacros(const TList* selIterator, const TL
           Double_t* results = (Double_t*)gROOT->ProcessLineSync("results;");
           Int_t nResults = (Int_t)gROOT->ProcessLineSync("n;");
      
-          if (results == 0)
-          {
+          if (results == 0) {
             Error("Apply macros", Form("Error reading data from macro \"%s\"", procIterator->At(i)->GetTitle()));
             continue;
           }
-          for (Int_t resInd = 0; resInd < nResults; resInd++)
-          {
+          for (Int_t resInd = 0; resInd < nResults; resInd++) {
             (*fDataTree) << Form("TrackData%d", i) << Form("Macro%d=", i) << results[resInd] << (Char_t*)"\n";   
           }
 
@@ -611,13 +585,10 @@ Bool_t AliEveTRDTrackList::ApplyProcessMacros(const TList* selIterator, const TL
     }
   }    
 
-  for (Int_t i = 0, histoIndex = 0; i < procIterator->GetEntries() && histoIndex < numHistoMacros; i++)
-  {
-    if (mProcType[i] == kSingleTrackHisto || mProcType[i] == kCorrelTrackHisto)
-    {
+  for (Int_t i = 0, histoIndex = 0; i < procIterator->GetEntries() && histoIndex < numHistoMacros; i++) {
+    if (mProcType[i] == kSingleTrackHisto || mProcType[i] == kCorrelTrackHisto) {
       // Might be empty (e.g. no tracks have been selected)!
-      if (histos[histoIndex] != 0)
-      {
+      if (histos[histoIndex]) {
         (*fDataTree) << Form("TrackData%d", i) << Form("Macro%d=", i) << histos[histoIndex] << (Char_t*)"\n";
       }
       histoIndex++;
@@ -641,7 +612,7 @@ Bool_t AliEveTRDTrackList::ApplyProcessMacros(const TList* selIterator, const TL
   histos = 0;
 
   // Clear root
-  gROOT->Reset();
+  // A.B. gROOT->Reset();
   
   // If there is data, select the first data set
   if (procIterator->GetEntries() > 0) SETBIT(fHistoDataSelected, 0);
@@ -666,23 +637,18 @@ void AliEveTRDTrackList::ApplySTSelectionMacros(const TList* iterator)
   Bool_t selectedByMacro = kFALSE;
 
   // Clear root
-  gROOT->Reset();
+  // A.B. gROOT->Reset();
 
-  // Select all tracks at first. A track is then deselect, if at least one selection macro
-  // returns kFALSE for this track
-  // Enable all tracks (Note: EnableListElements(..) will call "ElementChanged", which will cause unforeseen behavior!)
-  for (TEveElement::List_i iter = this->BeginChildren(); iter != this->EndChildren(); ++iter)
-  {
-    ((TEveElement*)(*iter))->SetRnrState(kTRUE);
-  }
+  // Select all tracks at first. A track is then deselected, if at least one selection macro
+  // returns kFALSE for this track.
+  // Enable all tracks (Note: EnableListElements(..) will call "ElementChanged", which will cause unforeseen behaviour!)
+  for (TEveElement::List_i iter = this->BeginChildren(); iter != this->EndChildren(); ++iter) ((TEveElement*)(*iter))->SetRnrState(kTRUE);
   SetRnrState(kTRUE);
   
-  for (Int_t i = 0; i < iterator->GetEntries(); i++)
-  {
+  for (Int_t i = 0; i < iterator->GetEntries(); i++){
     macro = (TMacroData*)fMacroList->GetValue(iterator->At(i)->GetTitle());
 
-    if (!macro)
-    {
+    if (!macro){
       Error("Apply selection macros", 
             Form("Macro list is corrupted: Macro \"%s\" is not registered!", iterator->At(i)->GetTitle()));
       continue;
@@ -696,8 +662,7 @@ void AliEveTRDTrackList::ApplySTSelectionMacros(const TList* iterator)
     macroType = macro->GetType();
 
     // Single track select macro
-    if (macroType == kSingleTrackSelect)
-    {
+    if (macroType == kSingleTrackSelect){
       // Walk through the list of tracks
       for (TEveElement::List_i iter = this->BeginChildren(); iter != this->EndChildren(); ++iter)
       {
@@ -708,29 +673,26 @@ void AliEveTRDTrackList::ApplySTSelectionMacros(const TList* iterator)
         // If the track has already been deselected, nothing is to do here
         if (!track1->GetRnrState()) continue;
 
-        track1->ExportToCINT((Text_t*)"automaticTrack");
         // Cast to AliTRDtrackV1
+        gROOT->ProcessLineSync(Form("AliEveTRDTrack *automaticTrack = (AliEveTRDTrack*)0x%xl;", track1));
         gROOT->ProcessLineSync("AliTRDtrackV1* automaticTrackV1_1 = (AliTRDtrackV1*)automaticTrack->GetUserData();");
         selectedByMacro = (Bool_t)gROOT->ProcessLineSync(macro->GetCmd());
         track1->SetRnrState(selectedByMacro && track1->GetRnrState());               
       }
     }
     // Correlated tracks select macro
-    else if (macroType == kCorrelTrackSelect)
-    {
+    else if (macroType == kCorrelTrackSelect){
       // Will be processed in ApplyProcessMacros(...)
       continue;
-    }
-    else
-    {
+    } else {
       Error("Apply selection macros", 
-            Form("Macro list corrupted: Macro \"%s/%s.C\" is not registered as a selection macro!", 
-                 macro->GetPath(), macro->GetName()));
+        Form("Macro list corrupted: Macro \"%s/%s.C\" is not registered as a selection macro!", 
+        macro->GetPath(), macro->GetName()));
     } 
   }
 
   // Clear root
-  gROOT->Reset();  
+  // A.B. gROOT->Reset();  
 }
 
 //______________________________________________________
@@ -746,8 +708,7 @@ AliEveTRDTrackList::AliEveTRDTrackListMacroType AliEveTRDTrackList::GetMacroType
   AliEveTRDTrackListMacroType type = kUnknown;
 
   // Re-do the check of the macro type
-  if (!UseList)
-  {
+  if (!UseList){
     // Single track select macro or single track histo macro?
     TFunction* f = gROOT->GetGlobalFunctionWithPrototype(name, "const AliTRDtrackV1*", kTRUE);
     if (f != 0x0)
@@ -790,12 +751,12 @@ AliEveTRDTrackList::AliEveTRDTrackListMacroType AliEveTRDTrackList::GetMacroType
       if (strstr(f->GetMangledName(), "oPconstsPAliTRDtrackV1mUsP") != 0x0 &&
           strstr(f->GetMangledName(), "cOconstsPAliTRDtrackV1mUsP") != 0x0)
       {
-        // Single track select macro?
+        // Correlated track select macro?
         if (!strcmp(f->GetReturnTypeName(), "Bool_t")) 
         { 
           type = kCorrelTrackSelect;     
         }
-        // single track histo macro?
+        // Correlated track histo macro?
         else if (!strcmp(f->GetReturnTypeName(), "TH1*"))
         {
           type = kCorrelTrackHisto;
@@ -904,10 +865,10 @@ void AliEveTRDTrackList::UpdateTrackStyle(AliEveTRDTrack::AliEveTRDTrackState s,
       CLRBIT(fSelectedStyle, AliEveTRDTrack::kSource);
       switch(ss)
       {
-      case AliTRDReconstructor::kLQPID:
+      case AliTRDpidUtil::kLQ:
         CLRBIT(fSelectedStyle, AliEveTRDTrack::kPID);
         break;
-      case AliTRDReconstructor::kNNPID:
+      case AliTRDpidUtil::kNN:
         SETBIT(fSelectedStyle, AliEveTRDTrack::kPID);
         break;
       }
@@ -923,8 +884,8 @@ void AliEveTRDTrackList::UpdateTrackStyle(AliEveTRDTrack::AliEveTRDTrackState s,
         CLRBIT(fSelectedStyle, AliEveTRDTrack::kTrackModel);
         break;
       case AliEveTRDTrack::kKalman:
-        AliWarning("Kalman fit under testing for the moment.");
-        //SETBIT(fSelectedStyle, AliEveTRDTrack::kTrackModel);
+        //AliWarning("Kalman fit under testing for the moment.");
+        SETBIT(fSelectedStyle, AliEveTRDTrack::kTrackModel);
         break;
       }
       break;