]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MONITOR/monitorGDC.cxx
Changes to compile with Root6 on macosx64
[u/mrichter/AliRoot.git] / MONITOR / monitorGDC.cxx
index 425172ef8abd2437ab68d6d76bbfbea75e079e2b..924a5c1819a870f39624f73c55dc6971e86da32f 100644 (file)
 
 #include <TError.h>
 #include <TSysEvtHandler.h>
-#ifdef DATE_SYS
+#ifdef ALI_DATE
 #include <TROOT.h>
 #include <TSystem.h>
 #include <TDatime.h>
 #include "AliRawReaderDate.h"
 #include "event.h"
 #include "monitor.h"
-#ifdef ALI_HLT
-#include <AliLevel3.h>
-#include <AliL3Transform.h>
-#include <AliL3MemHandler.h>
-#include <AliL3TrackArray.h>
+/*
+#include <AliHLTStandardIncludes.h>
+#include <AliHLTTransform.h>
+#include <AliHLTMemHandler.h>
+#include <AliHLTTrackArray.h>
+#include <AliHLTHoughMaxFinder.h>
+#include <AliHLTHoughBaseTransformer.h>
+#include <AliHLTHough.h>
+#include <AliHLTBenchmark.h>
+#include <AliHLTITSclusterer.h>
+#include <AliHLTITSVertexerZ.h>
+#include <AliHLTITStracker.h>
+*/
+#include "AliESDEvent.h"
+#include "AliESDVertex.h"
+#include "AliTracker.h"
+#include <AliKalmanTrack.h>
+#include "AliITSgeomTGeo.h"
+#include "AliITSgeom.h"
 #endif
-#endif
-
 
 //_____________________________________________________________________________
 class AliGDCInterruptHandler : public TSignalHandler {
@@ -55,14 +67,15 @@ private:
 
 //_____________________________________________________________________________
 AliGDCInterruptHandler::AliGDCInterruptHandler() : 
-  TSignalHandler(kSigInterrupt, kFALSE) 
+  TSignalHandler(kSigInterrupt, kFALSE),
+  fStop(kFALSE)
 {
-  fStop = kFALSE;
-};
+
+}
 
 
 //_____________________________________________________________________________
-#ifdef DATE_SYS
+#ifdef ALI_DATE
 int main(int argc, char** argv)
 {
   // set ROOT in batch mode
@@ -70,6 +83,7 @@ int main(int argc, char** argv)
 
   // open a log file
   FILE* file = fopen("monitorGDC.log", "w");
+
   TDatime time;
 
   // get data from a file or online from this node
@@ -87,15 +101,34 @@ 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
   // initialize HLT transformations
-  if (!AliL3Transform::Init("./", kFALSE)) {
-    ::Fatal("AliL3Transform::Init", "HLT initialization failed");
-  }
-#endif
+  //  if (!AliHLTTransform::Init("./", kFALSE)) {
+  //    ::Fatal("AliHLTTransform::Init", "HLT initialization failed");
+  //  }
+
+  AliESDEvent *esd = new AliESDEvent;
+  esd->CreateStdContent();
+
+  //  AliITSgeom *geom = new AliITSgeom();
+  //  geom->ReadNewFile("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymmFMD.det");
+  //  if (!geom) return 1;
+  //  Int_t sfield = 0;
+  //  switch ((Int_t)(AliHLTTransform::GetSolenoidField()+0.5)) {
+  //  case 2:
+  //    sfield = AliMagF::k2kG;
+  //    break;
+  //  case 5:
+  //    sfield = AliMagF::k5kG;
+  //    break;
+  //  default:
+  //    ::Fatal("AliHLTTransform::GetSolenoidField", "Incorrect magnetic field");
+  //  }
+
+  // Init PID
+  AliPID pid;
 
   // create the signal handler
   AliGDCInterruptHandler* handler = new AliGDCInterruptHandler;
@@ -115,70 +148,188 @@ int main(int argc, char** argv)
       continue;
     }
 
-#ifdef ALI_HLT
-    // run the HLT tracker
-    AliLevel3* hlt = new AliLevel3((Char_t*)ptr);
-    hlt->Init("./", AliLevel3::kDate, 1);
-
-    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);
-  
-    gSystem->Exec("rm -rf hlt");
-    gSystem->MakeDirectory("hlt");
-    hlt->WriteFiles("./hlt/");
-    hlt->ProcessEvent(0, 35, 0);
+    AliRawReaderDate rawReader(ptr);
+    //    if ((rawReader.GetAttributes()[0] & 0x02) != 0) {
 
-    time.Set();
-    if (file) fprintf(file, "%s\n", time.AsString());
+    //      Int_t errorCode = rawReader.CheckData();
+    Int_t errorCode = 0;
+      if (errorCode && (errorCode != AliRawReader::kErrSize)) {
+       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]);
+       fprintf(file, "ERROR: %d\n\n", errorCode);
 
-    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");
-    }
+      } else {
 
-    gSystem->Exec("rm -rf hlt");
-    delete hlt;
+//     AliHLTBenchmark *fBenchmark = new AliHLTBenchmark();
+//     fBenchmark->Start("Overall timing");
 
-#else
+//     // ITS clusterer and vertexer
+//     fBenchmark->Start("ITS Clusterer");
+//     AliHLTITSclusterer clusterer(0);
+//     AliRawReader *itsrawreader=new AliRawReaderDate(ptr);
+//     TTree* treeClusters = new TTree("TreeL3ITSclusters"," "); //make a tree
+//     clusterer.Digits2Clusters(itsrawreader,treeClusters);
+//     fBenchmark->Stop("ITS Clusterer");
+       
+//     AliHLTITSVertexerZ vertexer;
+//     AliESDVertex *vertex = vertexer.FindVertexForCurrentEvent(geom,treeClusters);
+//     Double_t vtxPos[3];
+//     Double_t vtxErr[3]={0.005,0.005,0.010};
+//     vertex->GetXYZ(vtxPos);
+//     //      vertex->GetSigmaXYZ(vtxErr);
+//     esd->SetVertex(vertex);
+
+//     // TPC Hough reconstruction
+//     Float_t ptmin = 0.1*AliHLTTransform::GetSolenoidField();
+//     Float_t zvertex = vtxPos[2];
+
+//     // Run the Hough Transformer
+//     fBenchmark->Start("Init");
+//     AliHLTHough *hough1 = new AliHLTHough();
+
+//     hough1->SetThreshold(4);
+//     hough1->CalcTransformerParams(ptmin);
+//     hough1->SetPeakThreshold(70,-1);
+//     //      printf("Pointer is %x\n",ptr);
+//     hough1->Init("./", kFALSE, 100, kFALSE,4,0,(Char_t*)ptr,zvertex);
+//     hough1->SetAddHistograms();
+//     fBenchmark->Stop("Init");
+
+//     fBenchmark->Start("Init");
+//     AliHLTHough *hough2 = new AliHLTHough();
+
+//     hough2->SetThreshold(4);
+//     hough2->CalcTransformerParams(ptmin);
+//     hough2->SetPeakThreshold(70,-1);
+//     //      printf("Pointer is %x\n",ptr);
+//     hough2->Init("./", kFALSE, 100, kFALSE,4,0,(Char_t*)ptr,zvertex);
+//     hough2->SetAddHistograms();
+//     fBenchmark->Stop("Init");
+
+//     Int_t nglobaltracks = 0;
+//     /*
+//     hough1->StartProcessInThread(0,17);
+//     hough2->StartProcessInThread(18,35);
+
+//     //      gSystem->Sleep(20000);
+//     if(hough1->WaitForThreadFinish())
+//       ::Fatal("AliHLTHough::WaitForThreadFinish"," Can not join the required thread! ");
+//     if(hough2->WaitForThreadFinish())
+//       ::Fatal("AliHLTHough::WaitForThreadFinish"," Can not join the required thread! ");
+
+//     gSystem->MakeDirectory("hough1");
+//     hough1->WriteTracks("./hough1");
+//     gSystem->MakeDirectory("hough2");
+//     hough2->WriteTracks("./hough2");
+//     */
+
+//     for(int slice=0; slice<=17; slice++)
+//     {
+//       //      cout<<"Processing slice "<<slice<<endl;
+//       fBenchmark->Start("ReadData");
+//       hough1->ReadData(slice,0);
+//       fBenchmark->Stop("ReadData");
+//       fBenchmark->Start("Transform");
+//       hough1->Transform();
+//       fBenchmark->Stop("Transform");
+//       hough1->AddAllHistogramsRows();
+//       hough1->FindTrackCandidatesRow();
+//       fBenchmark->Start("AddTracks");
+//       hough1->AddTracks();
+//       fBenchmark->Stop("AddTracks");
+
+//       //      AliHLTTrackArray* tracks = (AliHLTTrackArray*)hough1->GetTracks(0);
+//       //      nglobaltracks += tracks->GetNTracks();
+//     }
+//     for(int slice=18; slice<=35; slice++)
+//     {
+//       //      cout<<"Processing slice "<<slice<<endl;
+//       fBenchmark->Start("ReadData");
+//       hough2->ReadData(slice,0);
+//       fBenchmark->Stop("ReadData");
+//       fBenchmark->Start("Transform");
+//       hough2->Transform();
+//       fBenchmark->Stop("Transform");
+//       hough2->AddAllHistogramsRows();
+//       hough2->FindTrackCandidatesRow();
+//       fBenchmark->Start("AddTracks");
+//       hough2->AddTracks();
+//       fBenchmark->Stop("AddTracks");
+
+//       //      AliHLTTrackArray* tracks = (AliHLTTrackArray*)hough2->GetTracks(0);
+//       //      nglobaltracks += tracks->GetNTracks();
+//     }
+
+//     nglobaltracks += hough1->FillESD(esd);
+//     nglobaltracks += hough2->FillESD(esd);
+
+//     // ITS tracker
+//     AliHLTITStracker itsTracker(0);
+//     itsTracker.SetVertex(vtxPos,vtxErr);
+
+//     itsTracker.LoadClusters(treeClusters);
+//     itsTracker.Clusters2Tracks(esd);
+//     itsTracker.UnloadClusters();
+
+//     fBenchmark->Stop("Overall timing");
+//     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]);
+//     if (errorCode) fprintf(file, "ERROR: %d\n", errorCode);
+
+//     if (file) fprintf(file, "Hough Transformer found %d tracks\n",nglobaltracks);
+
+//     hough1->DoBench("hough1");
+//     hough2->DoBench("hough2");
+//     fBenchmark->Analyze("overall");
+//     if (file) {
+//       FILE* bench = fopen("hough1.dat", "r");
+//       while (bench && !feof(bench)) {
+//         char buffer[256];
+//         if (!fgets(buffer, 256, bench)) break;
+//         fprintf(file, "%s", buffer);
+//       }
+//       fclose(bench);
+//     }
+//     if (file) {
+//       FILE* bench = fopen("hough2.dat", "r");
+//       while (bench && !feof(bench)) {
+//         char buffer[256];
+//         if (!fgets(buffer, 256, bench)) break;
+//         fprintf(file, "%s", buffer);
+//       }
+//       fclose(bench);
+//     }
+//     if (file) {
+//       FILE* bench = fopen("overall.dat", "r");
+//       while (bench && !feof(bench)) {
+//         char buffer[256];
+//         if (!fgets(buffer, 256, bench)) break;
+//         fprintf(file, "%s", buffer);
+//       }
+//       fclose(bench);
+//       fprintf(file, "\n\n");
+//     }
+
+//     delete hough1;
+//     delete hough2;
+
+//     esd->Reset();
+      }
+    //    }
+
+    /*
     // 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,15 +338,14 @@ 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();
     if (file) fflush(file);
+
   }
 
   gSystem->RemoveSignalHandler(handler);