monitor histograms for HLT added
authortkuhr <tkuhr@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 19 Sep 2003 14:43:34 +0000 (14:43 +0000)
committertkuhr <tkuhr@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 19 Sep 2003 14:43:34 +0000 (14:43 +0000)
12 files changed:
MONITOR/AliMonitorClient.cxx
MONITOR/AliMonitorControl.cxx
MONITOR/AliMonitorHLT.cxx [new file with mode: 0644]
MONITOR/AliMonitorHLT.h [new file with mode: 0644]
MONITOR/AliMonitorProcess.cxx
MONITOR/AliMonitorProcess.h
MONITOR/AliMonitorTPC.cxx
MONITOR/AliMonitorTrend.cxx
MONITOR/MONITORLinkDef.h
MONITOR/client.C
MONITOR/libMONITOR.pkg
MONITOR/monitor.C

index fca2f5d..3948b87 100644 (file)
@@ -1280,8 +1280,8 @@ Bool_t AliMonitorClient::LoadFavorites(Bool_t dialog)
   char buffer[256];
   while (!feof(file)) {
     if (fgets(buffer, 255, file) == NULL) break;
-    char* item = buffer;
-    char* folder = strtok(item, "/");
+    char* folder = strtok(buffer, "/");
+    char* item = strtok(NULL, "\n");
     if (item[strlen(item)-1] == '\n') item[strlen(item)-1] = 0;
     if (!folder || !item) continue;
 
@@ -1608,8 +1608,8 @@ void AliMonitorClient::LoadSettings()
   char buffer[256];
   while (!feof(file)) {
     if (fgets(buffer, 255, file) == NULL) break;
-    char* value = buffer;
-    char* token = strtok(value, "=");
+    char* token = strtok(buffer, "=");
+    char* value = strtok(NULL, "\n");
     if (!token || !value) continue;
     if (value[strlen(value)-1] == '\n') value[strlen(value)-1] = 0;
 
index 8e045e9..983625a 100644 (file)
@@ -511,6 +511,8 @@ void AliMonitorControl::UpdateStatus()
     status = "running ITS reconstruction"; break;
   case AliMonitorProcess::kRecV0s: 
     status = "running V0 reconstruction"; break;
+  case AliMonitorProcess::kRecHLT: 
+    status = "running HLT reconstruction"; break;
   case AliMonitorProcess::kFilling: 
     status = "filling monitor histograms"; break;
   case AliMonitorProcess::kUpdating: 
diff --git a/MONITOR/AliMonitorHLT.cxx b/MONITOR/AliMonitorHLT.cxx
new file mode 100644 (file)
index 0000000..9c2a517
--- /dev/null
@@ -0,0 +1,146 @@
+/**************************************************************************
+ * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ *                                                                        *
+ * Author: The ALICE Off-line Project.                                    *
+ * Contributors are mentioned in the code where appropriate.              *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/* $Id$ */
+
+///////////////////////////////////////////////////////////////////////////////
+//                                                                           //
+//  This class creates and fills the monitor histograms for the HLT          //
+//                                                                           //
+///////////////////////////////////////////////////////////////////////////////
+
+
+#include "AliMonitorHLT.h"
+#ifdef ALI_HLT
+#include <stdlib.h>
+#include "AliL3MemHandler.h"
+#include "AliL3SpacePointData.h"
+#include "AliL3TrackArray.h"
+#include "AliL3Track.h"
+#endif
+
+//_____________________________________________________________________________
+AliMonitorHLT::AliMonitorHLT(AliTPCParam* param)
+{
+// create a HLT monitor object with the given parameters
+
+  fParam = param;
+}
+
+//_____________________________________________________________________________
+AliMonitorHLT::~AliMonitorHLT()
+{
+}
+
+
+//_____________________________________________________________________________
+void AliMonitorHLT::CreateHistos(TFolder* folder)
+{
+// create the HLT monitor histograms
+
+  fFolder = folder->AddFolder("HLT", "HLT");
+
+  fClustersCharge = CreateHisto1("ClustersCharge", 
+                                "charge distribution of clusters", 
+                                100, 0, 1000, "charge", "#Delta N/N",
+                                AliMonitorHisto::kNormEvents);
+
+  Int_t nRows = fParam->GetNRowLow() + fParam->GetNRowUp();
+  fNClustersVsRow = CreateHisto1("NClustersVsRow", 
+                                "mean number of clusters per pad row", 
+                                nRows, -0.5, nRows-0.5,
+                                "pad row", "<N_{clusters}>",
+                                AliMonitorHisto::kNormEvents);
+
+  Int_t nSector = fParam->GetNInnerSector();
+  fNClustersVsSector = CreateHisto1("NClustersVsSector", 
+                                   "mean number of clusters per sector", 
+                                   nSector, -0.5, nSector-0.5, 
+                                   "sector", "<N_{clusters}>",
+                                   AliMonitorHisto::kNormEvents);
+
+  fNTracks = CreateTrend("NTracks", "number of tracks per event", 
+                        "N_{tracks}");
+
+  fTrackPt = CreateHisto1("TrackPt", "pt distribution of tracks", 
+                         90, 0, 3, "p_{t} [GeV/c]", "#Delta N/N",
+                         AliMonitorHisto::kNormEntries);
+
+  fTrackEta = CreateHisto1("TrackEta", "eta distribution of tracks", 
+                          100, -2, 2, "#eta", "#Delta N/N",
+                          AliMonitorHisto::kNormEntries);
+
+  fTrackPhi = CreateHisto1("TrackPhi", "phi distribution of tracks", 
+                          120, 0, 360, "#phi [#circ]", "#Delta N/N",
+                          AliMonitorHisto::kNormEntries);
+}
+
+
+#include <TCanvas.h>
+//_____________________________________________________________________________
+void AliMonitorHLT::FillHistos(AliRunLoader* /*runLoader*/, 
+                              AliRawReader* /*rawReader*/)
+{
+// fill the HLT monitor histogrms
+
+#ifndef ALI_HLT
+  Warning("FillHistos", "the code was compiled without HLT support");
+
+#else
+  AliL3MemHandler memHandler;
+  for (Int_t iSector = 0; iSector < fParam->GetNInnerSector(); iSector++) {
+    char fileName[256];
+    sprintf(fileName, "hlt/points_%d_-1.raw", iSector);
+    if (!memHandler.SetBinaryInput(fileName)) {
+      Warning("FillHistos", "could not open file %s", fileName);
+      continue;
+    }
+    AliL3SpacePointData* clusters = 
+      (AliL3SpacePointData*) memHandler.Allocate();
+    UInt_t nClusters = 0;
+    memHandler.Binary2Memory(nClusters, clusters);
+
+    for (UInt_t iCluster = 0; iCluster < nClusters; iCluster++) {
+      AliL3SpacePointData& cluster = clusters[iCluster];
+      fClustersCharge->Fill(cluster.fCharge);
+      fNClustersVsRow->Fill(cluster.fPadRow);
+      fNClustersVsSector->Fill(iSector);
+    }
+
+    memHandler.Free();
+    memHandler.CloseBinaryInput();
+  }
+
+  fNClustersVsSector->ScaleErrorBy(10.);
+
+  if (!memHandler.SetBinaryInput("hlt/tracks.raw")) {
+    Warning("FillHistos", "could not open file hlt/tracks.raw");
+    return;
+  }
+  AliL3TrackArray* tracks = new AliL3TrackArray;
+  memHandler.Binary2TrackArray(tracks);
+
+  fNTracks->Fill(tracks->GetNTracks());
+  for (Int_t iTrack = 0; iTrack < tracks->GetNTracks(); iTrack++) {
+    AliL3Track* track = tracks->GetTrack(iTrack);
+    fTrackPt->Fill(track->GetPt());
+    fTrackEta->Fill(track->GetPseudoRapidity());
+    fTrackPhi->Fill(track->GetPsi() * TMath::RadToDeg());
+  }
+
+  delete tracks;
+  memHandler.CloseBinaryInput();
+#endif
+}
diff --git a/MONITOR/AliMonitorHLT.h b/MONITOR/AliMonitorHLT.h
new file mode 100644 (file)
index 0000000..16c1015
--- /dev/null
@@ -0,0 +1,47 @@
+#ifndef ALIMONITORHLT_H
+#define ALIMONITORHLT_H
+/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice                               */
+
+/* $Id$ */
+
+#include "AliMonitor.h"
+#include "AliMonitorHisto.h"
+#include "AliMonitorTrend.h"
+#include "AliTPCParam.h"
+
+
+class AliMonitorHLT : public AliMonitor {
+public:
+  AliMonitorHLT(AliTPCParam* param);
+  virtual ~AliMonitorHLT();
+
+  virtual void     CreateHistos(TFolder* folder);
+  virtual void     FillHistos(AliRunLoader* runLoader, 
+                             AliRawReader* rawReader);
+
+private:
+  AliTPCParam*     fParam;              // TPC parameters
+
+  AliMonitorHisto* fClustersCharge;     // charge distribution of HLT clusters
+  AliMonitorHisto* fNClustersVsRow;     // mean number of HLT clusters per pad row
+  AliMonitorHisto* fNClustersVsSector;  // mean number of HLT clusters per sector
+  AliMonitorTrend* fNTracks;            // number of HLT tracks per event
+  AliMonitorHisto* fTrackPt;            // pt distribution of HLT tracks
+  AliMonitorHisto* fTrackEta;           // eta distribution of HLT tracks
+  AliMonitorHisto* fTrackPhi;           // phi distribution of HLT tracks
+
+  ClassDef(AliMonitorHLT, 0)   // creation and filling of monitor histograms for HLT
+};
+
+#endif
+
+
+
+
+
+
+
+
+
index f5127da..6519cd0 100644 (file)
@@ -30,6 +30,7 @@
 #include "AliMonitorTPC.h"
 #include "AliMonitorITS.h"
 #include "AliMonitorV0s.h"
+#include "AliMonitorHLT.h"
 #include "AliRawReaderRoot.h"
 #include "AliLoader.h"
 #include "AliRun.h"
@@ -98,6 +99,9 @@ AliMonitorProcess::AliMonitorProcess(const char* alienDir,
   fMonitors.Add(new AliMonitorTPC(fTPCParam));
   fMonitors.Add(new AliMonitorITS(fITSgeom));
   fMonitors.Add(new AliMonitorV0s);
+#ifdef ALI_HLT
+  fMonitors.Add(new AliMonitorHLT(fTPCParam));
+#endif
 
   for (Int_t iMonitor = 0; iMonitor < fMonitors.GetEntriesFast(); iMonitor++) {
     ((AliMonitor*) fMonitors[iMonitor])->CreateHistos(fTopFolder);
@@ -121,6 +125,9 @@ AliMonitorProcess::AliMonitorProcess(const char* alienDir,
   fServerSocket->SetOption(kNoBlock, 1);
   fDisplaySocket = NULL;
   CheckForConnections();
+#ifdef ALI_HLT
+  fHLT = NULL;
+#endif
 
   fStatus = kStopped;
   fStopping = kFALSE;
@@ -145,6 +152,10 @@ AliMonitorProcess::~AliMonitorProcess()
   fFile->Close();
   delete fFile;
   gSystem->Unlink("monitor_tree.root");
+
+#ifdef ALI_HLT
+  delete fHLT;
+#endif
 }
 
 
@@ -229,9 +240,9 @@ Bool_t AliMonitorProcess::CheckForNewFile()
     TString entryCopy(entry);
     char* p = const_cast<char*>(entryCopy.Data());
     if (!strtok(p, "_") || !p) continue;  // host name
-    char* dateStr = strtok(p, "_");
+    char* dateStr = strtok(NULL, "_");
     if (!dateStr || !p) continue;
-    char* timeStr = strtok(p, ".");
+    char* timeStr = strtok(NULL, ".");
     if (!timeStr || !p) continue;
     Long_t date = atoi(dateStr);
     Long_t time = atoi(timeStr);
@@ -261,6 +272,9 @@ Bool_t AliMonitorProcess::ProcessFile()
   if (nEvents <= 0) return kFALSE;
   Info("ProcessFile", "found %d event(s) in file %s", 
        nEvents, fFileName.Data());
+#ifdef ALI_HLT
+  CreateHLT(fFileName);
+#endif
 
   // loop over the events
   for (Int_t iEvent = 0; iEvent < nEvents; iEvent++) {
@@ -284,6 +298,8 @@ Bool_t AliMonitorProcess::ProcessFile()
     if (fStopping) break;
     if (!ReconstructV0s()) return kFALSE;
     if (fStopping) break;
+    if (!ReconstructHLT(iEvent)) return kFALSE;
+    if (fStopping) break;
 
     if (fDisplaySocket) fDisplaySocket->Send("new event");
 
@@ -319,6 +335,11 @@ Bool_t AliMonitorProcess::ProcessFile()
     if (fStopping) break;
   }
 
+#ifdef ALI_HLT
+  delete fHLT;
+  fHLT = NULL;
+#endif
+
   return kTRUE;
 }
 
@@ -499,6 +520,77 @@ Bool_t AliMonitorProcess::ReconstructV0s()
   return kTRUE;
 }
 
+//_____________________________________________________________________________
+#ifdef ALI_HLT
+void AliMonitorProcess::CreateHLT(const char* fileName)
+{
+// create the HLT (Level3) object
+
+  if (fHLT) delete fHLT;
+
+  char name[256];
+  strcpy(name, fileName);
+  fHLT = new AliLevel3(name);
+  fHLT->Init("./", AliLevel3::kRaw, 1);
+
+  fHLT->SetClusterFinderParam(0, 0, kTRUE);
+  
+  Int_t phi_segments = 50;
+  Int_t eta_segments = 100;
+  Int_t trackletlength = 3;
+  Int_t tracklength = 5;
+  Int_t rowscopetracklet = 2;
+  Int_t rowscopetrack = 2;
+  Double_t min_pt_fit = 0;
+  Double_t maxangle = 1.31;
+  Double_t goodDist = 5;
+  Double_t maxphi = 100;
+  Double_t maxeta = 100;
+  Double_t hitChi2Cut = 15;//100
+  Double_t goodHitChi2 = 5;//20;
+  Double_t trackChi2Cut = 10;
+  fHLT->SetTrackerParam(phi_segments, eta_segments, 
+                       trackletlength, tracklength,
+                       rowscopetracklet, rowscopetrack,
+                       min_pt_fit, maxangle, goodDist, hitChi2Cut,
+                       goodHitChi2, trackChi2Cut, 50, maxphi, maxeta, kTRUE);
+  
+  fHLT->WriteFiles("./hlt/");  
+}
+#endif
+
+//_____________________________________________________________________________
+Bool_t AliMonitorProcess::ReconstructHLT(Int_t iEvent)
+{
+// run the HLT cluster and track finder
+
+  fStatus = kRecHLT;
+
+#ifndef ALI_HLT
+  Warning("ReconstructHLT", "the code was compiled without HLT support");
+  return kTRUE;
+
+#else
+  gSystem->Exec("rm -rf hlt");
+  gSystem->MakeDirectory("hlt");
+  if (!fHLT) return kFALSE;
+
+  fHLT->ProcessEvent(0, 35, iEvent);
+
+  // remove the event number from the file names
+  char command[256];
+  sprintf(command, "rename points_%d points hlt/*.raw", iEvent);
+  gSystem->Exec(command);
+  sprintf(command, "rename tracks_tr_%d tracks_tr hlt/*.raw", iEvent);
+  gSystem->Exec(command);
+  sprintf(command, "rename tracks_gl_%d tracks_gl hlt/*.raw", iEvent);
+  gSystem->Exec(command);
+  sprintf(command, "rename tracks_%d tracks hlt/*.raw", iEvent);
+  gSystem->Exec(command);
+  return kTRUE;
+#endif
+}
+
 
 //_____________________________________________________________________________
 Bool_t AliMonitorProcess::WriteHistos()
index 172bcbe..cb4c4e3 100644 (file)
@@ -18,6 +18,9 @@
 #include "AliRawReader.h"
 #include "AliTPCParam.h"
 #include "AliITSgeom.h"
+#ifdef ALI_HLT
+#include "AliLevel3.h"
+#endif
 
 
 class AliMonitorProcess : public TObject {
@@ -40,7 +43,7 @@ public:
   UInt_t           GetEventBunchNumber();
 
   enum EStatus     {kStopped, kWaiting, kReading, kRecTPC, kRecITS, kRecV0s,
-                   kFilling, kUpdating, kWriting, kResetting, 
+                   kRecHLT, kFilling, kUpdating, kWriting, kResetting, 
                    kConnecting, kBroadcasting};
   EStatus          GetStatus() {return fStatus;};
   Bool_t           WillStop() {return fStopping;};
@@ -63,6 +66,10 @@ private:
   Bool_t           ReconstructTPC(AliRawReader* rawReader);
   Bool_t           ReconstructITS(AliRawReader* rawReader);
   Bool_t           ReconstructV0s();
+#ifdef ALI_HLT
+  void             CreateHLT(const char* fileName);
+#endif
+  Bool_t           ReconstructHLT(Int_t iEvent);
 
   Bool_t           WriteHistos();
   void             StartNewRun();
@@ -76,6 +83,9 @@ private:
   AliITSgeom*      fITSgeom;
   TString          fLogicalFileName;
   TString          fFileName;
+#ifdef ALI_HLT
+  AliLevel3*       fHLT;
+#endif
 
   UInt_t           fRunNumber;
   UInt_t           fSubRunNumber;
index 54f7135..94b8181 100644 (file)
@@ -193,7 +193,7 @@ void AliMonitorTPC::FillHistos(AliRunLoader* runLoader,
       fNClustersVsSector->Fill(iSector);
     }
   }
-  fNClustersVsSector->ScaleErrorBy(100.);
+  fNClustersVsSector->ScaleErrorBy(10.);
 
   delete clustersRow;
   tpcLoader->UnloadRecPoints();
index ae7254a..2ae7263 100644 (file)
@@ -222,7 +222,7 @@ Bool_t AliMonitorTrend::GetEvent(Int_t)
 {
 // there is no single event trend
 
-  Info("GetEvent", "there is no trend for single events available");
+//  Info("GetEvent", "there is no trend for single events available");
   return kFALSE;
 }
 
index fafedb0..bb9b3de 100644 (file)
@@ -17,6 +17,7 @@
 #pragma link C++ class  AliMonitorDataTPC+;
 #pragma link C++ class  AliMonitorITS+;
 #pragma link C++ class  AliMonitorV0s+;
+#pragma link C++ class  AliMonitorHLT+;
 #pragma link C++ class  AliMonitorProcess+;
 #pragma link C++ class  AliMonitorControl+;
 #pragma link C++ class  AliMonitorDialog+;
index 5c6f1e7..dee945a 100644 (file)
@@ -4,5 +4,8 @@
 
 void client()
 {
+  if (!gROOT->GetClass("AliMonitorClient")) {
+    gSystem->Load("libMONITOR.so");
+  }
   new AliMonitorClient;
 }
index cc174e4..d5a214a 100644 (file)
@@ -1,6 +1,7 @@
 SRCS:=  AliMonitorPlot.cxx AliMonitorHisto.cxx AliMonitorTrend.cxx \
        AliMonitor.cxx \
        AliMonitorTPC.cxx AliMonitorITS.cxx AliMonitorV0s.cxx \
+       AliMonitorHLT.cxx \
        AliMonitorProcess.cxx AliMonitorControl.cxx \
        AliMonitorDialog.cxx AliMonitorClient.cxx
 
index 116c26a..af1fe4c 100644 (file)
@@ -7,12 +7,28 @@
 
 void monitor(const char* alienDir = ".")
 {
+  // load libraries
+  if (strcmp(gSystem->Getenv("ALIHLT_USEPACKAGE"), "ALIROOT") == 0) {
+    if (!gROOT->GetClass("AliLevel3")) {
+      gSystem->Load("libAliL3Src.so");
+      gSystem->Load("libAliL3Misc.so");
+      gSystem->Load("libAliL3Hough.so");
+      gSystem->Load("libAliL3Comp.so");
+    }
+  }
+  if (!gROOT->GetClass("AliMonitorProcess")) {
+    gSystem->Load("libMONITOR.so");
+  }
+
+  // make sure galice.root and compression tables are there
   if (!gSystem->Which(".", "galice.root")) {
     gInterpreter->ExecuteMacro("$ALICE_ROOT/MONITOR/galice.C");
   }
   if (!gSystem->Which(".", "Table0.dat")) {
     gSystem->Exec("cp $ALICE_ROOT/RAW/Table*.dat .");
   }
+
+  // start the monitoring
   AliMonitorProcess process(alienDir);
   process.Run();
 //  new AliMonitorControl(&process);