update macros for displaying performance/calibration results
authorabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Oct 2009 10:51:08 +0000 (10:51 +0000)
committerabercuci <abercuci@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 7 Oct 2009 10:51:08 +0000 (10:51 +0000)
TRD/qaRec/macros/AliTRDperformanceTrain.h
TRD/qaRec/macros/helper.C [new file with mode: 0644]
TRD/qaRec/macros/makeCalibResults.C
TRD/qaRec/macros/makeResults.C

index c4d5c51de02e45fd226d383608f638bfd3c7962f..448d6ddad8f0c91f2b3b281d3fccc98f4b08e858 100644 (file)
@@ -59,17 +59,7 @@ const Char_t *fgkTRDtaskOpt[NTRDTASKS+1] = {
   ,"ALL"
 };
 
-#if ! defined (__CINT__) || defined (__MAKECINT__)
-#include "TFileMerger.h"
-#include "TSystem.h"
-#include "TString.h"
-#include "TObjString.h"
-#include "TObjArray.h"
-#include "TError.h"
 #include <cstring>
-#include <fstream>
-#endif
-
 
 //____________________________________________
 Bool_t HasReadMCData(Char_t *opt){
@@ -81,79 +71,5 @@ Bool_t HasReadFriendData(Char_t *opt){
   return !(Bool_t)strstr(opt, "NOFR");
 }
 
-//____________________________________________
-Int_t ParseOptions(Char_t *trd)
-{
-  Int_t fSteerTask = 1;
-  TObjArray *tasksArray = TString(trd).Tokenize(" ");
-  for(Int_t isel = 0; isel < tasksArray->GetEntriesFast(); isel++){
-    TString s = (dynamic_cast<TObjString *>(tasksArray->UncheckedAt(isel)))->String();
-    if(s.CompareTo("ALL") == 0){
-      for(Int_t itask = 0; itask < NTRDQATASKS; itask++) SETBIT(fSteerTask, itask);
-      continue;
-    } else { 
-      Bool_t foundOpt = kFALSE;  
-      for(Int_t itask = 2; itask < NTRDTASKS; itask++){
-        if(s.CompareTo(fgkTRDtaskOpt[itask]) != 0) continue;
-        SETBIT(fSteerTask, itask); SETBIT(fSteerTask, kInfoGen);
-        foundOpt = kTRUE;
-        break;
-      }
-      if(!foundOpt) Info("run.C", Form("TRD task %s not implemented (yet).", s.Data()));
-    }
-  }
-  // extra rules for calibration tasks
-//   if(TSTBIT(fSteerTask, kCalibration)) SETBIT(fSteerTask, kCheckDET);
-//   if(TSTBIT(fSteerTask, kMultiplicity)) SETBIT(fSteerTask, kEfficiency);
-//   if(TSTBIT(fSteerTask, kEfficiencyMC)) SETBIT(fSteerTask, kEfficiency);
-//   if(TSTBIT(fSteerTask, kClErrParam)) SETBIT(fSteerTask, kResolution);
-//   if(TSTBIT(fSteerTask, kAlignment)) SETBIT(fSteerTask, kResolution);
-//   if(TSTBIT(fSteerTask, kPIDRefMaker)) SETBIT(fSteerTask, kCheckPID);
-
-  return fSteerTask;
-}
-
-//______________________________________________________
-// void mergeProd(const Char_t *mark, const Char_t *files)
-// {
-//   const Int_t kBatch = 20;
-// 
-//   TFileMerger *fFM = new TFileMerger(1);
-//   fFM->OutputFile(Form("%s/0_%s",  gSystem->ExpandPathName("$PWD"), mark));
-// 
-//   Int_t jbatch = 0, nbatch = 0;
-//   string filename;
-//   ifstream file(files);
-//   while(getline(file, filename)){
-//     if(Int_t(filename.find(mark)) < 0) continue;
-//     fFM->AddFile(filename.c_str()); nbatch++;
-//     if(nbatch==kBatch){
-//       //printf("MERGE BATCH %d [%d]\n", jbatch, nbatch);
-//       fFM->Merge(); jbatch++;
-//       new(fFM) TFileMerger(kTRUE);
-//       fFM->OutputFile(Form("%s/%d_%s",  gSystem->ExpandPathName("$PWD"), jbatch, mark));
-//       nbatch=0;
-//     }
-//   }
-//   if(nbatch){
-//     //printf("MERGE BATCH %d[%d]\n", jbatch, nbatch);
-//     fFM->Merge();
-//     jbatch++;
-//   }
-//   if(!jbatch){
-//     delete fFM;
-//     return;
-//   }
-// 
-//   new(fFM) TFileMerger(kTRUE);
-//   fFM->OutputFile(Form("%s/%s",  gSystem->ExpandPathName("$PWD"), mark));
-//   for(Int_t ib=jbatch; ib--;){
-//     fFM->AddFile(Form("%s/%d_%s",  gSystem->ExpandPathName("$PWD"), ib, mark));
-//     gSystem->Exec(Form("rm -f %s/%d_%s", gSystem->ExpandPathName("$PWD"), ib, mark));
-//   }
-//   fFM->Merge();
-//   delete fFM;
-// }
-
 #endif
 
diff --git a/TRD/qaRec/macros/helper.C b/TRD/qaRec/macros/helper.C
new file mode 100644 (file)
index 0000000..3470b87
--- /dev/null
@@ -0,0 +1,81 @@
+#if ! defined (__CINT__) || defined (__MAKECINT__)
+#include "TFileMerger.h"
+#include "TSystem.h"
+#include "TString.h"
+#include "TObjString.h"
+#include "TObjArray.h"
+#include "TError.h"
+#endif
+
+//____________________________________________
+Int_t ParseOptions(Char_t *trd)
+{
+  Int_t fSteerTask = 1;
+  TObjArray *tasksArray = TString(trd).Tokenize(" ");
+  for(Int_t isel = 0; isel < tasksArray->GetEntriesFast(); isel++){
+    TString s = (dynamic_cast<TObjString *>(tasksArray->UncheckedAt(isel)))->String();
+    if(s.CompareTo("ALL") == 0){
+      for(Int_t itask = 0; itask < NTRDQATASKS; itask++) SETBIT(fSteerTask, itask);
+      continue;
+    } else { 
+      Bool_t foundOpt = kFALSE;  
+      for(Int_t itask = 2; itask < NTRDTASKS; itask++){
+        if(s.CompareTo(fgkTRDtaskOpt[itask]) != 0) continue;
+        SETBIT(fSteerTask, itask); SETBIT(fSteerTask, kInfoGen);
+        foundOpt = kTRUE;
+        break;
+      }
+      if(!foundOpt) Info("ParseOptions()", Form("TRD task %s not implemented (yet).", s.Data()));
+    }
+  }
+  // extra rules for calibration tasks
+//   if(TSTBIT(fSteerTask, kCalibration)) SETBIT(fSteerTask, kCheckDET);
+//   if(TSTBIT(fSteerTask, kMultiplicity)) SETBIT(fSteerTask, kEfficiency);
+//   if(TSTBIT(fSteerTask, kEfficiencyMC)) SETBIT(fSteerTask, kEfficiency);
+//   if(TSTBIT(fSteerTask, kClErrParam)) SETBIT(fSteerTask, kResolution);
+//   if(TSTBIT(fSteerTask, kAlignment)) SETBIT(fSteerTask, kResolution);
+//   if(TSTBIT(fSteerTask, kPIDRefMaker)) SETBIT(fSteerTask, kCheckPID);
+
+  return fSteerTask;
+}
+
+// //______________________________________________________
+void mergeProd(const Char_t *mark, const Char_t *files, const Int_t kBatch = 20)
+{
+  TFileMerger *fFM = 0x0;
+
+  Int_t jbatch = 0, nbatch = 0;
+  string filename;
+  ifstream file(files);
+  while(getline(file, filename)){
+    if(Int_t(filename.find(mark)) < 0) continue;
+    if(!nbatch){
+      if(fFM) fFM = new(fFM) TFileMerger(kTRUE);
+      else fFM = new TFileMerger(kTRUE);
+      fFM->OutputFile(Form("%s/%d_%s",  gSystem->ExpandPathName("$PWD"), jbatch, mark));
+    }
+    fFM->AddFile(filename.c_str()); nbatch++;
+    if(nbatch==kBatch){
+      printf("MERGING BATCH %d [%d] ... \n", jbatch, nbatch);
+      fFM->Merge(); jbatch++;
+      nbatch=0;
+    }
+  }
+  if(nbatch){
+    printf("MERGING INCOMPLETE BATCH %d [%d] ... \n", jbatch, nbatch);
+    fFM->Merge(); jbatch++;
+  }
+  if(!jbatch){
+    delete fFM;
+    return;
+  }
+
+  new(fFM) TFileMerger(kTRUE);
+  fFM->OutputFile(Form("%s/%s",  gSystem->ExpandPathName("$PWD"), mark));
+  for(Int_t ib=jbatch; ib--;){
+    fFM->AddFile(Form("%s/%d_%s",  gSystem->ExpandPathName("$PWD"), ib, mark));
+    gSystem->Exec(Form("rm -f %s/%d_%s", gSystem->ExpandPathName("$PWD"), ib, mark));
+  }
+  fFM->Merge();
+  delete fFM;
+}
index 2d1d26c4fba4e4efbb4962971d893fda38963ef5..3c890fb232bff33db1868f338394548dc538a942 100644 (file)
@@ -66,6 +66,7 @@
 #endif
 
 #include "AliTRDperformanceTrain.h"
+#include "helper.C"
 //#include "../../PWG1/macros/AddPerformanceTask.h"
 
 Char_t *libs[] = {"libProofPlayer.so", "libANALYSIS.so", "libTRDqaRec.so", "libSTAT.so"};
index ecf8bb90e7c14864edb8bf853de3e0f0053ca89a..48ea961092c638e34ba8a14fa586615b397d4cf5 100644 (file)
@@ -63,6 +63,7 @@
 #endif
 
 #include "AliTRDperformanceTrain.h"
+#include "helper.C"
 //#include "../../PWG1/macros/AddPerformanceTask.h"
 
 Char_t *libs[] = {"libProofPlayer.so", "libANALYSIS.so", "libTRDqaRec.so"};
@@ -71,7 +72,7 @@ TCanvas *c = 0x0;
 Bool_t mc(kFALSE), friends(kFALSE);
 
 void processTRD(TNamed* task);
-void processAliTask(TNamed* task);
+void processESD(TNamed* task);
 void makeResults(Char_t *opt = "ALL", const Char_t *files=0x0, Bool_t kGRID=kFALSE)
 {
   if(kGRID){
@@ -108,7 +109,7 @@ void makeResults(Char_t *opt = "ALL", const Char_t *files=0x0, Bool_t kGRID=kFAL
     task = (AliAnalysisTask*)ctask->New();
 
     if(task->IsA()->InheritsFrom("AliTRDrecoTask")) processTRD(task);
-    else processAliTask(task);
+    else processESD(task);
   }
   delete ctask;
   delete c;
@@ -143,9 +144,28 @@ void processTRD(TNamed *otask)
 }
 
 //______________________________________________________
-void processAliTask(TNamed *otask)
+void processESD(TNamed *otask)
 {
-  AliAnalysisTask *task = dynamic_cast<AliAnalysisTask*>(otask);
-  Info("makeResults.C", Form("Processing of task %s not implemented yet.", task->GetName()));
-  delete task;
+  AliTRDcheckESD *esd = dynamic_cast<AliTRDcheckESD*>(otask);
+  if(!esd){
+    Info("makeResults.C", "Processing of task AliTRDcheckESD failed.");
+    delete otask;
+    return;
+  }
+
+  if(!esd->Load(Form("%s/TRD.Performance.root", gSystem->ExpandPathName("$PWD")))){
+    Error("makeResults.C", Form("Load data container for task %s failed.", esd->GetName()));
+    delete esd;
+    return;
+  }
+
+  esd->Terminate();
+
+  TGraphErrors *g = 0x0; Int_t ipic=0;
+  while((g=esd->GetGraph(ipic, ""))){
+    c->Clear(); g->Draw("apl");
+    c->SaveAs(Form("%s_Fig%02d.gif", esd->GetName(), ipic));
+    ipic++;
+  }
+  delete esd;
 }