]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MONITOR/monitorGDC.cxx
data consistency check monitoring added
[u/mrichter/AliRoot.git] / MONITOR / monitorGDC.cxx
index 7f3beed8d7872a23de00c8991256abd42b9cd5ff..134dcd318cbb708fef190df4f71d05187c57969d 100644 (file)
 ///////////////////////////////////////////////////////////////////////////////
 
 #include <TError.h>
+#include <TSysEvtHandler.h>
 #ifdef DATE_SYS
 #include <TROOT.h>
 #include <TSystem.h>
-#include <TSysEvtHandler.h>
 #include <TDatime.h>
 #include "AliRawReaderDate.h"
 #include "event.h"
@@ -62,14 +62,18 @@ AliGDCInterruptHandler::AliGDCInterruptHandler() :
 
 
 //_____________________________________________________________________________
+#ifdef DATE_SYS
 int main(int argc, char** argv)
 {
-#ifdef DATE_SYS
   // set ROOT in batch mode
   gROOT->SetBatch();   
 
   // open a log file
+#ifdef ALI_HLT
   FILE* file = fopen("monitorGDC.log", "w");
+#else
+  FILE* file = NULL;
+#endif
   TDatime time;
 
   // get data from a file or online from this node
@@ -87,7 +91,7 @@ int main(int argc, char** argv)
   if (status) ::Fatal("monitorDeclareTable", monitorDecodeError(status));
 
   // declare this monitoring program to DATE
-  status = monitorDeclareMp("GDC monitoring (HLT)");
+  status = monitorDeclareMp("GDC physics monitoring");
   if (status) ::Fatal("monitorDeclareMp", monitorDecodeError(status));
 
 #ifdef ALI_HLT
@@ -116,69 +120,79 @@ int main(int argc, char** argv)
     }
 
 #ifdef ALI_HLT
-    // run the HLT tracker
-    AliLevel3* hlt = new AliLevel3((Char_t*)ptr);
-    hlt->Init("./", AliLevel3::kDate, 1);
+    AliRawReaderDate rawReader(ptr);
+    if ((rawReader.GetAttributes()[0] & 0x02) != 0) {
+
+      // run the HLT tracker
+      AliLevel3* hlt = new AliLevel3((Char_t*)ptr);
+      hlt->Init("./", AliLevel3::kDate, 1);
 
-    hlt->SetClusterFinderParam(-1, -1, kTRUE);
+      hlt->SetClusterFinderParam(-1, -1, kTRUE);
   
-    Int_t phiSegments = 50;
-    Int_t etaSegments = 100;
-    Int_t trackletlength = 3;
-    Int_t tracklength = 20;//40 or 5
-    Int_t rowscopetracklet = 2;
-    Int_t rowscopetrack = 10;
-    Double_t minPtFit = 0;
-    Double_t maxangle = 0.1745;
-    Double_t goodDist = 5;
-    Double_t maxphi = 0.1;
-    Double_t maxeta = 0.1;
-    Double_t hitChi2Cut = 15;//100 or 15
-    Double_t goodHitChi2 = 5;//20 or 5
-    Double_t trackChi2Cut = 10;//50 or 10
-    hlt->SetTrackerParam(phiSegments, etaSegments, 
-                        trackletlength, tracklength,
-                        rowscopetracklet, rowscopetrack,
-                        minPtFit, maxangle, goodDist, hitChi2Cut,
-                        goodHitChi2, trackChi2Cut, 50, maxphi, maxeta, kTRUE);
+      Int_t phiSegments = 50;
+      Int_t etaSegments = 100;
+      Int_t trackletlength = 3;
+      Int_t tracklength = 20;//40 or 5
+      Int_t rowscopetracklet = 2;
+      Int_t rowscopetrack = 10;
+      Double_t minPtFit = 0;
+      Double_t maxangle = 0.1745;
+      Double_t goodDist = 5;
+      Double_t maxphi = 0.1;
+      Double_t maxeta = 0.1;
+      Double_t hitChi2Cut = 15;//100 or 15
+      Double_t goodHitChi2 = 5;//20 or 5
+      Double_t trackChi2Cut = 10;//50 or 10
+      hlt->SetTrackerParam(phiSegments, etaSegments, 
+                          trackletlength, tracklength,
+                          rowscopetracklet, rowscopetrack,
+                          minPtFit, maxangle, goodDist, hitChi2Cut,
+                          goodHitChi2, trackChi2Cut, 50, maxphi, maxeta, 
+                          kTRUE);
   
-    gSystem->Exec("rm -rf hlt");
-    gSystem->MakeDirectory("hlt");
-    hlt->WriteFiles("./hlt/");
-    hlt->ProcessEvent(0, 35, 0);
-
-    time.Set();
-    if (file) fprintf(file, "%s\n", time.AsString());
-
-    AliL3MemHandler memHandler;
-    if (!memHandler.SetBinaryInput("hlt/tracks_0.raw")) {
-      if (file) fprintf(file, "no HLT tracks\n");
-      continue;
-    }
-    AliL3TrackArray* tracks = new AliL3TrackArray;
-    memHandler.Binary2TrackArray(tracks);
-    if (file) fprintf(file, "HLT found %d tracks\n", tracks->GetNTracks());
-    delete tracks;
-    memHandler.CloseBinaryInput();
-
-    hlt->DoBench("hlt");
-    if (file) {
-      FILE* bench = fopen("hlt.dat", "r");
-      while (bench && !feof(bench)) {
-       char buffer[256];
-       if (!fgets(buffer, 256, bench)) break;
-       fprintf(file, "%s", buffer);
+      gSystem->Exec("rm -rf hlt");
+      gSystem->MakeDirectory("hlt");
+      hlt->WriteFiles("./hlt/");
+      hlt->ProcessEvent(0, 35, 0);
+
+      time.Set();
+      if (file) fprintf(file, "%s\n", time.AsString());
+      if (file) fprintf(file, "run: %d  event: %d %d\n", 
+                       rawReader.GetRunNumber(), 
+                       rawReader.GetEventId()[0], rawReader.GetEventId()[1]);
+
+      AliL3MemHandler memHandler;
+      if (!memHandler.SetBinaryInput("hlt/tracks_0.raw")) {
+       if (file) fprintf(file, "no HLT tracks\n");
+       continue;
+      }
+      AliL3TrackArray* tracks = new AliL3TrackArray;
+      memHandler.Binary2TrackArray(tracks);
+      if (file) fprintf(file, "HLT found %d tracks\n", tracks->GetNTracks());
+      delete tracks;
+      memHandler.CloseBinaryInput();
+
+      hlt->DoBench("hlt");
+      if (file) {
+       FILE* bench = fopen("hlt.dat", "r");
+       while (bench && !feof(bench)) {
+         char buffer[256];
+         if (!fgets(buffer, 256, bench)) break;
+         fprintf(file, "%s", buffer);
+       }
+       fclose(bench);
+       fprintf(file, "\n");
       }
-      fclose(bench);
-      fprintf(file, "\n");
-    }
 
-    gSystem->Exec("rm -rf hlt");
-    delete hlt;
+      gSystem->Exec("rm -rf hlt");
+      delete hlt;
+    }
 
 #else
     // read run, event, detector, DDL numbers and data size
     AliRawReaderDate rawReader(ptr);
+    time.Set();
+    printf("\n%s\n", time.AsString());
     printf("run: %d  event: %d %d\n", rawReader.GetRunNumber(), 
           rawReader.GetEventId()[0], rawReader.GetEventId()[1]);
     while (rawReader.ReadMiniHeader()) {
@@ -187,11 +201,9 @@ int main(int argc, char** argv)
             rawReader.GetDataSize());
     }
 
-    time.Set();
-    if (file) fprintf(file, "%s\n", time.AsString());
-
 #endif
 
+    gSystem->Sleep(100);   // sleep for 0.1 second
     free(ptr);
 
     gSystem->ProcessEvents();
@@ -201,9 +213,14 @@ int main(int argc, char** argv)
   gSystem->RemoveSignalHandler(handler);
   if (file) fclose(file);
 
+  return 0;
+}
+
 #else
+int main(int /*argc*/, char** /*argv*/)
+{
   ::Fatal("main", "this program was compiled without DATE");
-#endif
 
-  return 0;
+  return 1;
 }
+#endif