pipe support for the error bar (C.Holm), minor fix for proof mode in the plugin ...
authoragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 17 Jan 2011 12:46:12 +0000 (12:46 +0000)
committeragheata <agheata@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 17 Jan 2011 12:46:12 +0000 (12:46 +0000)
ANALYSIS/AliAnalysisAlien.cxx
ANALYSIS/AliAnalysisManager.cxx
ANALYSIS/AliAnalysisManager.h

index 355729c..e6327de 100644 (file)
@@ -1673,10 +1673,10 @@ const char *AliAnalysisAlien::GetJobStatus(Int_t jobidstart, Int_t lastid, Int_t
    Int_t pid;
    for (Int_t ijob=0; ijob<nentries; ijob++) {
       status = (TGridJobStatus *)list->At(ijob);
-      pid = gROOT->ProcessLine(Form("atoi(((TAlienJobStatus*)0x%lx)->GetKey(\"queueId\"));", (ULong_t)status));
+      pid = gROOT->ProcessLine(Form("atoi(((TAlienJobStatus*)%p)->GetKey(\"queueId\"));", status));
       if (pid<jobidstart) continue;
       if (pid == lastid) {
-         gROOT->ProcessLine(Form("sprintf((char*)0x%lx,((TAlienJobStatus*)0x%lx)->GetKey(\"status\"));",(ULong_t)mstatus, (ULong_t)status));
+         gROOT->ProcessLine(Form("sprintf((char*)%p,((TAlienJobStatus*)%p)->GetKey(\"status\"));",mstatus, status));
       }   
       switch (status->GetStatus()) {
          case TGridJobStatus::kWAITING:
@@ -2445,6 +2445,9 @@ Bool_t AliAnalysisAlien::StartAnalysis(Long64_t /*nentries*/, Long64_t /*firstEn
          if (!fIncludePath.IsNull()) {
             TString includePath = fIncludePath;
             includePath.ReplaceAll(" ",":");
+            includePath.ReplaceAll("$ALICE_ROOT","");
+            includePath.ReplaceAll("${ALICE_ROOT}","");
+            includePath.ReplaceAll("-I","");
             includePath.Strip(TString::kTrailing, ':');
             Info("StartAnalysis", "Adding extra includes: %s",includePath.Data()); 
             optionsList.Add(new TNamed("ALIROOT_EXTRA_INCLUDES",includePath.Data()));
@@ -2461,15 +2464,15 @@ Bool_t AliAnalysisAlien::StartAnalysis(Long64_t /*nentries*/, Long64_t /*firstEn
                printf("%s  %s\n", obj->GetName(), obj->GetTitle());
             }   
             if (!gROOT->ProcessLine(Form("gProof->UploadPackage(\"%s\");",alirootLite.Data()))
-              && !gROOT->ProcessLine(Form("gProof->EnablePackage(\"%s\", (TList*)0x%lx);",alirootLite.Data(),(ULong_t)&optionsList))) {
+              && !gROOT->ProcessLine(Form("gProof->EnablePackage(\"%s\", (TList*)%p);",alirootLite.Data(),&optionsList))) {
                   Info("StartAnalysis", "AliRootProofLite enabled");
             } else {                      
                Error("StartAnalysis", "There was an error trying to enable package AliRootProofLite.par");
                return kFALSE;
             }   
          } else {
-            if (gROOT->ProcessLine(Form("gProof->EnablePackage(\"VO_ALICE@AliRoot::%s\", (TList*)0x%lx);", 
-                                   fAliROOTVersion.Data(), (ULong_t)&optionsList))) {
+            if (gROOT->ProcessLine(Form("gProof->EnablePackage(\"VO_ALICE@AliRoot::%s\", (TList*)%p, kTRUE);", 
+                                   fAliROOTVersion.Data(), &optionsList))) {
                Error("StartAnalysis", "There was an error trying to enable package VO_ALICE@AliRoot::%s", fAliROOTVersion.Data());
                return kFALSE;
             }         
@@ -2547,7 +2550,7 @@ Bool_t AliAnalysisAlien::StartAnalysis(Long64_t /*nentries*/, Long64_t /*firstEn
          }   
          TFileCollection *coll = new TFileCollection();
          coll->AddFromFile(fFileForTestMode);
-         gROOT->ProcessLine(Form("gProof->RegisterDataSet(\"test_collection\", (TFileCollection*)0x%lx, \"OV\");", (ULong_t)coll));
+         gROOT->ProcessLine(Form("gProof->RegisterDataSet(\"test_collection\", (TFileCollection*)%p, \"OV\");", coll));
          gROOT->ProcessLine("gProof->ShowDataSets()");
       }
       return kTRUE;
index 8834508..e62b54d 100644 (file)
@@ -27,6 +27,7 @@
 
 #include "AliAnalysisManager.h"
 
+#include <cerrno>
 #include <Riostream.h>
 #include <TError.h>
 #include <TClass.h>
@@ -2022,6 +2023,19 @@ void AliAnalysisManager::ExecAnalysis(Option_t *option)
 }
 
 //______________________________________________________________________________
+Bool_t AliAnalysisManager::IsPipe(std::ostream &out)
+{
+// Check if the stdout is connected to a pipe (C.Holm)
+  Bool_t ispipe = kFALSE;
+  out.seekp(0, std::ios_base::cur);
+  if (out.fail()) {
+    out.clear();
+    if (errno == ESPIPE) ispipe = kTRUE;
+  }
+  return ispipe;
+}
+   
+//______________________________________________________________________________
 void AliAnalysisManager::SetInputEventHandler(AliVEventHandler* const handler)
 {
 // Set the input event handler and create a container for it.
@@ -2184,8 +2198,10 @@ void AliAnalysisManager::ProgressBar(const char *opname, Long64_t current, Long6
    static Bool_t oneoftwo = kFALSE;
    static Int_t nrefresh = 0;
    static Int_t nchecks = 0;
+   static char lastChar = 0;
    const char symbol[4] = {'-','\\','|','/'}; 
    
+   if (!lastChar) lastChar = (IsPipe(std::cerr))?'\r':'\n';
    if (!refresh) {
       nrefresh = 0;
       if (!size) return;
@@ -2248,10 +2264,10 @@ void AliAnalysisManager::ProgressBar(const char *opname, Long64_t current, Long6
      Int_t rsec   = remain % 60;
      Int_t rmin   = (remain / 60) % 60;
      Int_t rhour  = (remain / 60 / 60);
-     fprintf(stderr, "[%6.2f %%]   TIME %.2d:%.2d:%.2d  ETA %.2d:%.2d:%.2d\r",
-            percent, hours, minutes, seconds, rhour, rmin, rsec);
+     fprintf(stderr, "[%6.2f %%]   TIME %.2d:%.2d:%.2d  ETA %.2d:%.2d:%.2d%c",
+            percent, hours, minutes, seconds, rhour, rmin, rsec, lastChar);
    }
-   else fprintf(stderr, "[%6.2f %%]\r", percent);
+   else fprintf(stderr, "[%6.2f %%]%c", percent, lastChar);
    if (refresh && oneoftwo) oname = nname;
    if (owatch) owatch->Continue();
    if (last) {
index d61d0f2..990f65b 100644 (file)
@@ -19,6 +19,9 @@
 #ifndef ROOT_THashTable
 #include <THashTable.h>
 #endif
+#ifndef ROOT_Riostream
+#include <Riostream.h>
+#endif
 
 class TClass;
 class TTree;
@@ -115,6 +118,7 @@ enum EAliAnalysisFlags {
    TObjArray          *GetTopTasks() const        {return fTopTasks;}
    TTree              *GetTree() const            {return fTree;}
    TObjArray          *GetZombieTasks() const     {return fZombies;}
+   static Bool_t       IsPipe(std::ostream &out);
    Bool_t              IsProofMode() const        {return (fMode==kProofAnalysis)?kTRUE:kFALSE;}
    Bool_t              IsRemote() const           {return fIsRemote;}
    Bool_t              IsUsingDataSet() const     {return TObject::TestBit(kUseDataSet);}