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;
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;
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:
--- /dev/null
+/**************************************************************************
+ * 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
+}
--- /dev/null
+#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
+
+
+
+
+
+
+
+
+
#include "AliMonitorTPC.h"
#include "AliMonitorITS.h"
#include "AliMonitorV0s.h"
+#include "AliMonitorHLT.h"
#include "AliRawReaderRoot.h"
#include "AliLoader.h"
#include "AliRun.h"
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);
fServerSocket->SetOption(kNoBlock, 1);
fDisplaySocket = NULL;
CheckForConnections();
+#ifdef ALI_HLT
+ fHLT = NULL;
+#endif
fStatus = kStopped;
fStopping = kFALSE;
fFile->Close();
delete fFile;
gSystem->Unlink("monitor_tree.root");
+
+#ifdef ALI_HLT
+ delete fHLT;
+#endif
}
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);
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++) {
if (fStopping) break;
if (!ReconstructV0s()) return kFALSE;
if (fStopping) break;
+ if (!ReconstructHLT(iEvent)) return kFALSE;
+ if (fStopping) break;
if (fDisplaySocket) fDisplaySocket->Send("new event");
if (fStopping) break;
}
+#ifdef ALI_HLT
+ delete fHLT;
+ fHLT = NULL;
+#endif
+
return kTRUE;
}
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()
#include "AliRawReader.h"
#include "AliTPCParam.h"
#include "AliITSgeom.h"
+#ifdef ALI_HLT
+#include "AliLevel3.h"
+#endif
class AliMonitorProcess : public TObject {
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;};
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();
AliITSgeom* fITSgeom;
TString fLogicalFileName;
TString fFileName;
+#ifdef ALI_HLT
+ AliLevel3* fHLT;
+#endif
UInt_t fRunNumber;
UInt_t fSubRunNumber;
fNClustersVsSector->Fill(iSector);
}
}
- fNClustersVsSector->ScaleErrorBy(100.);
+ fNClustersVsSector->ScaleErrorBy(10.);
delete clustersRow;
tpcLoader->UnloadRecPoints();
{
// 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;
}
#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+;
void client()
{
+ if (!gROOT->GetClass("AliMonitorClient")) {
+ gSystem->Load("libMONITOR.so");
+ }
new AliMonitorClient;
}
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
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);