]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - ANALYSIS/AliAnalysisDataContainer.cxx
Event Server can now run without GUI.
[u/mrichter/AliRoot.git] / ANALYSIS / AliAnalysisDataContainer.cxx
index fee26174d210d025255352635440a379a863f883..8784f502e51cc591e1c5c0f65f94f1a9a0c0ad61 100644 (file)
@@ -51,7 +51,6 @@
 #include <TTree.h>
 #include <TH1.h>
 #include <TROOT.h>
-#include <TStopwatch.h>
 
 #include "AliAnalysisManager.h"
 #include "AliAnalysisDataContainer.h"
@@ -60,6 +59,9 @@
 
 using std::endl;
 using std::cout;
+using std::ios;
+using std::setiosflags;
+using std::setprecision;
 ClassImp(AliAnalysisDataContainer)
 
 //______________________________________________________________________________
@@ -279,21 +281,26 @@ void AliAnalysisDataContainer::PrintContainer(Option_t *option, Int_t indent) co
    for (Int_t i=0; i<indent; i++) ind += " ";
    TString opt(option);
    opt.ToLower();
+   TString ctype = "Container";
+   if (IsExchange()) ctype = "Exchange container";
    Bool_t dep = (opt.Contains("dep"))?kTRUE:kFALSE;
    if (!dep) {
-      printf("%sContainer: %s  type: %s POST_LOOP=%i", ind.Data(), GetName(), GetTitle(), IsPostEventLoop());
-      if (fProducer) 
-         printf("%s = Data producer: task %s",ind.Data(),fProducer->GetName());
-      else
-         printf("%s= No data producer",ind.Data());
-      printf("%s = Consumer tasks: ", ind.Data());
-      if (!fConsumers || !fConsumers->GetEntriesFast()) printf("-none-\n");
-      else printf("\n");
+      if (IsPostEventLoop()) printf("%s%s: %s     DATA TYPE: %s POST_LOOP task\n", ind.Data(), ctype.Data(), GetName(), GetTitle());
+      else printf("%s%s: %s     DATA TYPE: %s\n", ind.Data(), ctype.Data(), GetName(), GetTitle());
+      if (!fProducer) 
+//         printf("%s = Data producer: task %s\n",ind.Data(),fProducer->GetName());
+//      else
+         printf("%s= Not connected to a data producer\n",ind.Data());
+      if (fConsumers && fConsumers->GetEntriesFast())
+         printf("%s = Client tasks indented below:\n", ind.Data());
    }
-   if (fFolderName.Length())
-     printf("Filename: %s  folder: %s\n", fFileName.Data(), fFolderName.Data());
-   else
-     printf("Filename: %s\n", fFileName.Data());
+   if (!IsExchange()) {
+      if (!fFolderName.IsNull())
+        printf("%s = Filename: %s  folder: %s\n", ind.Data(),fFileName.Data(), fFolderName.Data());
+      else
+        if (!fFileName.IsNull()) printf("%s = Filename: %s\n", ind.Data(),fFileName.Data());
+   }     
+   ((AliAnalysisDataContainer*)this)->SetTouched(kTRUE);  
    TIter next(fConsumers);
    AliAnalysisTask *task;
    while ((task=(AliAnalysisTask*)next())) task->PrintTask(option, indent+3);
@@ -405,7 +412,7 @@ AliAnalysisDataWrapper *AliAnalysisDataContainer::ExportData() const
       return pack;
    } 
    AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-   if (mgr->GetDebugLevel() > 1) printf("   ExportData: Wrapping data %s for container %s\n", fData->GetName(),GetName());
+   if (mgr && mgr->GetDebugLevel() > 1) printf("   ExportData: Wrapping data %s for container %s\n", fData->GetName(),GetName());
    pack = new AliAnalysisDataWrapper(fData);
    pack->SetName(fName.Data());
    return pack;
@@ -422,7 +429,7 @@ void AliAnalysisDataContainer::ImportData(AliAnalysisDataWrapper *pack)
          return;
       }   
       AliAnalysisManager *mgr = AliAnalysisManager::GetAnalysisManager();
-      if (mgr->GetDebugLevel() > 1) printf("   ImportData: Unwrapping data %s for container %s\n", fData->GetName(),GetName());
+      if (mgr && mgr->GetDebugLevel() > 1) printf("   ImportData: Unwrapping data %s for container %s\n", fData->GetName(),GetName());
       fDataReady = kTRUE;
       // Imported wrappers do not own data anymore (AG 13-11-07)
       pack->SetDeleteData(kFALSE);
@@ -505,7 +512,7 @@ AliAnalysisFileDescriptor::AliAnalysisFileDescriptor()
                           :TObject(), fLfn(), fGUID(), fUrl(), fPfn(), fSE(),
                            fIsArchive(kFALSE), fImage(0), fNreplicas(0), 
                            fStartBytes(0), fReadBytes(0), fSize(0), fOpenedAt(0), 
-                           fOpenTime(0.), fProcessingTime(0.), fThroughput(0.)
+                           fOpenTime(0.), fProcessingTime(0.), fThroughput(0.), fTimer()
 {
 // I/O constructor
 }
@@ -515,7 +522,7 @@ AliAnalysisFileDescriptor::AliAnalysisFileDescriptor(const TFile *file)
                           :TObject(), fLfn(), fGUID(), fUrl(), fPfn(), fSE(),
                            fIsArchive(kFALSE), fImage(0), fNreplicas(0), 
                            fStartBytes(0), fReadBytes(0), fSize(0), fOpenedAt(0), 
-                           fOpenTime(0.), fProcessingTime(0.), fThroughput(0.)
+                           fOpenTime(0.), fProcessingTime(0.), fThroughput(0.), fTimer()
 {
 // Normal constructor
    if (file->InheritsFrom("TAlienFile")) {
@@ -548,7 +555,7 @@ AliAnalysisFileDescriptor::AliAnalysisFileDescriptor(const AliAnalysisFileDescri
                            fIsArchive(other.fIsArchive), fImage(other.fImage),
                            fNreplicas(other.fNreplicas), fStartBytes(other.fStartBytes), fReadBytes(other.fReadBytes),
                            fSize(other.fSize), fOpenedAt(other.fOpenedAt), fOpenTime(other.fOpenTime),
-                           fProcessingTime(other.fProcessingTime), fThroughput(other.fThroughput)
+                           fProcessingTime(other.fProcessingTime), fThroughput(other.fThroughput), fTimer()
 {
 // CC
 }
@@ -587,10 +594,12 @@ AliAnalysisFileDescriptor::~AliAnalysisFileDescriptor()
 void AliAnalysisFileDescriptor::Done()
 {
 // Must be called at the end of processing, providing file->GetBytesRead() as argument.
+   fTimer.Stop();
    const Double_t megabyte = 1048576.;
-   Long64_t stampnow = time(0);
+//   Long64_t stampnow = time(0);
    fReadBytes = TFile::GetFileBytesRead()-fStartBytes;
-   fProcessingTime = stampnow-fOpenedAt;
+//   fProcessingTime = stampnow-fOpenedAt;
+   fProcessingTime = fTimer.RealTime();
    Double_t readsize = fReadBytes/megabyte;
    fThroughput = readsize/fProcessingTime;
 }   
@@ -611,7 +620,7 @@ void AliAnalysisFileDescriptor::Print(Option_t*) const
 }
 
 //______________________________________________________________________________
-void AliAnalysisFileDescriptor::SavePrimitive(ostream &out, Option_t *)
+void AliAnalysisFileDescriptor::SavePrimitive(std::ostream &out, Option_t *)
 {
 // Stream info to file
    const Double_t megabyte = 1048576.;
@@ -622,11 +631,13 @@ void AliAnalysisFileDescriptor::SavePrimitive(ostream &out, Option_t *)
    out << "image        " << fImage << endl;
    out << "nreplicas    " << fNreplicas << endl;
    out << "openstamp    " << fOpenedAt << endl;
-   out << setiosflags(ios::fixed) << setprecision(3);
+   std::ios_base::fmtflags original_flags = out.flags();
+   out << setiosflags(std::ios::fixed) << std::setprecision(3);
    out << "opentime     " << fOpenTime << endl;
    out << "runtime      " << fProcessingTime << endl;
    out << "filesize     " << fSize/megabyte << endl;
    out << "readsize     " << fReadBytes/megabyte << endl;
    out << "throughput   " << fThroughput << endl;
+   out.flags(original_flags);
 }
-   
+