make it compile with root version 3.10/01a
authortkuhr <tkuhr@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 2 Dec 2003 18:32:01 +0000 (18:32 +0000)
committertkuhr <tkuhr@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 2 Dec 2003 18:32:01 +0000 (18:32 +0000)
MONITOR/AliMonitorProcess.cxx
MONITOR/AliMonitorProcess.h
MONITOR/monitor.C

index b663163..98550bc 100644 (file)
@@ -70,17 +70,31 @@ const Int_t AliMonitorProcess::fgkPort = 9327;
 
 
 //_____________________________________________________________________________
-AliMonitorProcess::AliMonitorProcess(const char* alienDir,
+AliMonitorProcess::AliMonitorProcess(
+#if ROOT_VERSION_CODE <= 199169   // 3.10/01
+                                    const char* /*alienHost*/,
+#else
+                                    const char* alienHost,
+#endif
+                                    const char* alienDir,
                                     const char* fileNameGalice)
 {
 // initialize the monitoring process and the monitor histograms
 
+#if ROOT_VERSION_CODE <= 199169   // 3.10/01
   fGrid = TGrid::Connect("alien", gSystem->Getenv("USER"));
+#else
+  fGrid = TGrid::Connect(alienHost, gSystem->Getenv("USER"));
+#endif
   if (!fGrid || fGrid->IsZombie() || !fGrid->IsConnected()) {
     delete fGrid;
     Fatal("AliMonitorProcess", "could not connect to alien");
   }
+#if ROOT_VERSION_CODE <= 199169   // 3.10/01
   fGrid->cd(alienDir);
+#else
+  fAlienDir = alienDir;
+#endif
   fLogicalFileName = "";
   fFileName = "";
 
@@ -185,7 +199,9 @@ AliMonitorProcess::~AliMonitorProcess()
   fSockets.Delete();
   delete fDisplaySocket;
 
+#if ROOT_VERSION_CODE <= 199169   // 3.10/01
   fGrid->Close();
+#endif
   delete fGrid;
 
   fFile->Close();
@@ -280,12 +296,27 @@ Bool_t AliMonitorProcess::CheckForNewFile()
 {
 // check whether a new file was registered in alien
 
+#if ROOT_VERSION_CODE <= 199169   // 3.10/01
   TGridResult* result = fGrid->Ls();
+#else
+  Grid_ResultHandle_t handle = fGrid->OpenDir(fAlienDir);
+  if (!handle) {
+    Error("CheckForNewFile", "could not open alien directory %s", 
+         fAlienDir.Data());
+    return kFALSE;
+  }
+  TGridResult* result = fGrid->CreateGridResult(handle);
+#endif
   Long_t maxDate = -1;
   Long_t maxTime = -1;
   TString fileName;
 
+#if ROOT_VERSION_CODE <= 199169   // 3.10/01
   while (const char* entry = result->Next()) {
+#else
+  while (Grid_Result_t* resultEntry = result->Next()) {
+    const char* entry = resultEntry->name.c_str();
+#endif
     // entry = host_date_time.root
     TString entryCopy(entry);
     char* p = const_cast<char*>(entryCopy.Data());
@@ -304,12 +335,31 @@ Bool_t AliMonitorProcess::CheckForNewFile()
     }
   }
 
+  delete result;
   if (maxDate < 0) return kFALSE;  // no files found
   if (fLogicalFileName.CompareTo(fileName) == 0) return kFALSE;  // no new file
 
   fLogicalFileName = fileName;
-  TGridResult* result2 = fGrid->GetPhysicalFileNames(fLogicalFileName.Data());
-  fFileName = result2->Next();
+#if ROOT_VERSION_CODE <= 199169   // 3.10/01
+  result = fGrid->GetPhysicalFileNames(fLogicalFileName.Data());
+  fFileName = result->Next();
+#else
+  handle = fGrid->GetPhysicalFileNames(fLogicalFileName.Data());
+  if (!handle) {
+    Error("CheckForNewFile", "could not get physical file names for %s", 
+         fLogicalFileName.Data());
+    return kFALSE;
+  }
+  result = fGrid->CreateGridResult(handle);
+  Grid_Result_t* resultEntry = result->Next();
+  if (!resultEntry) {
+    Error("CheckForNewFile", "could not get physical file names for %s", 
+         fLogicalFileName.Data());
+    return kFALSE;
+  }
+  fFileName = resultEntry->name.c_str();
+#endif
+  delete result;
 
   return kTRUE;
 }
index a426cdd..a685da2 100644 (file)
@@ -28,7 +28,8 @@ class AliL3Hough;
 
 class AliMonitorProcess : public TObject {
 public:
-  AliMonitorProcess(const char* alienDir,
+  AliMonitorProcess(const char* alienHost,
+                   const char* alienDir,
                    const char* fileNameGalice = "galice.root");
   AliMonitorProcess(const AliMonitorProcess& process);
   AliMonitorProcess& operator = (const AliMonitorProcess& process);
@@ -90,6 +91,7 @@ private:
   static const Int_t fgkPort;          // port number for client connections
 
   TGrid*           fGrid;               // pointer to AliEn
+  TString          fAlienDir;           // name of alien directory
   AliRunLoader*    fRunLoader;          // the current run loader
   AliTPCParam*     fTPCParam;           // TPC parameters
   AliITSgeom*      fITSgeom;            // ITS parameters
index cc3555c..a53c4fa 100644 (file)
@@ -1,11 +1,12 @@
 #if !defined(__CINT__) || defined(__MAKECINT__)
-#include "TSystem.h"
-#include "TInterpreter.h"
+#include <TSystem.h>
+#include <TError.h>
+#include <TInterpreter.h>
 #include "MONITOR/AliMonitorProcess.h"
 #include "MONITOR/AliMonitorControl.h"
 #endif
 
-void monitor(const char* alienDir = ".")
+void monitor(const char* alienHost = "alien://", const char* alienDir = ".")
 {
   // load libraries
   if (strcmp(gSystem->Getenv("ALIHLT_USEPACKAGE"), "ALIROOT") == 0) {
@@ -22,14 +23,19 @@ void monitor(const char* alienDir = ".")
 
   // make sure galice.root and compression tables are there
   if (!gSystem->Which(".", "galice.root")) {
-    gInterpreter->ExecuteMacro("$ALICE_ROOT/MONITOR/galice.C");
+//    gInterpreter->ExecuteMacro("$ALICE_ROOT/MONITOR/galice.C");
+    ::Error("monitor.C", "no galice.root file found.\n"
+           "please copy a galice.root file with the correct TPC and ITS"
+           "parameters\n and the correct magnetic field to the current" 
+           "directory");
+    return;
   }
   if (!gSystem->Which(".", "Table0.dat")) {
     gSystem->Exec("cp $ALICE_ROOT/RAW/Table*.dat .");
   }
 
   // start the monitoring
-  AliMonitorProcess *process = new AliMonitorProcess(alienDir);
+  AliMonitorProcess *process = new AliMonitorProcess(alienHost, alienDir);
   //  process->Run();
   new AliMonitorControl(process);
 }