find_package(CPack)
+# ZeroMQ
+# ------------------------------
+find_package(ZeroMQ)
#--------------------------------------------------------------------------------#
# Environment/Compiler Configuration #
set ( EINCLUDE )
set ( ELIBSDIR )
-set ( ELIBS EveBase EveDet MUONmapping MUONevaluation MUONsim MUONrec MUONgeometry MUONcalib MUONbase MUONraw MUONtrigger MUONcore TPCsim TPCrec TPCbase TPCutil ITSbase ITSsim ITSrec ITSUpgradeBase ITSUpgradeSim PMDbase PMDsim PMDrec TRDbase TRDsim TRDrec FMDbase FMDsim FMDrec TOFbase TOFrec TOFsim PHOSUtils PHOSbase PHOSsim PHOSrec ACORDEbase ACORDEsim ACORDErec HMPIDbase HMPIDrec HMPIDsim ZDCbase ZDCsim ZDCrec VZERObase VZEROsim VZEROrec EMCALUtils EMCALbase EMCALsim EMCALrec EMCALraw BCM STRUCT T0base T0sim T0rec STEER CDB AOD ESD STEERBase ANALYSISalice ANALYSIS THijing hijing THbtp TEPEMGEN FASTSIM microcern RAWDatasim RAWDatarec RAWDatabase HLTbase XMLParser STAT OADB MONITOR)
+set ( ELIBS EveBase EveDet MUONmapping MUONevaluation MUONsim MUONrec MUONgeometry MUONcalib MUONbase MUONraw MUONtrigger MUONcore TPCsim TPCrec TPCbase TPCutil ITSbase ITSsim ITSrec ITSUpgradeBase ITSUpgradeSim PMDbase PMDsim PMDrec TRDbase TRDsim TRDrec FMDbase FMDsim FMDrec TOFbase TOFrec TOFsim PHOSUtils PHOSbase PHOSsim PHOSrec ACORDEbase ACORDEsim ACORDErec HMPIDbase HMPIDrec HMPIDsim ZDCbase ZDCsim ZDCrec VZERObase VZEROsim VZEROrec EMCALUtils EMCALbase EMCALsim EMCALrec EMCALraw BCM STRUCT T0base T0sim T0rec STEER CDB AOD ESD STEERBase ANALYSISalice ANALYSIS THijing hijing THbtp TEPEMGEN FASTSIM microcern RAWDatasim RAWDatarec RAWDatabase HLTbase XMLParser STAT OADB)
if(PYTHIA6)
list (APPEND ELIBS EVGEN)
set ( EINCLUDE )
set ( ELIBSDIR )
-set ( ELIBS EveBase EveHLT EveDet MONITOR HLTbase HLTrec AliHLTUtil AliHLTEve AliHLTTPC TPCcalib AliHLTRCU AliHLTMUON TPCsim TPCrec TPCbase ITSbase ITSsim ITSrec ITSUpgradeBase ITSUpgradeSim TRDbase TRDrec AliHLTTRD PHOSbase PHOSUtils EMCALbase EMCALraw EMCALUtils EMCALrec EMCALsim TRIGGERbase VZERObase VZEROrec VZEROsim TRIGGERbase MUONmapping MUONevaluation MUONsim MUONrec MUONgeometry MUONcalib MUONbase MUONraw MUONtrigger MUONcore STEER CDB AOD ESD STEERBase ANALYSISalice ANALYSIS FASTSIM microcern RAWDatasim RAWDatarec RAWDatabase XMLParser STAT TOFbase TOFsim FMDbase FMDsim FMDrec PMDbase T0base OADB)
+set ( ELIBS EveBase EveHLT EveDet HLTbase HLTrec AliHLTUtil AliHLTEve AliHLTTPC TPCcalib AliHLTRCU AliHLTMUON TPCsim TPCrec TPCbase ITSbase ITSsim ITSrec ITSUpgradeBase ITSUpgradeSim TRDbase TRDrec AliHLTTRD PHOSbase PHOSUtils EMCALbase EMCALraw EMCALUtils EMCALrec EMCALsim TRIGGERbase VZERObase VZEROrec VZEROsim TRIGGERbase MUONmapping MUONevaluation MUONsim MUONrec MUONgeometry MUONcalib MUONbase MUONraw MUONtrigger MUONcore STEER CDB AOD ESD STEERBase ANALYSISalice ANALYSIS FASTSIM microcern RAWDatasim RAWDatarec RAWDatabase XMLParser STAT TOFbase TOFsim FMDbase FMDsim FMDrec PMDbase T0base OADB)
set ( PACKBLIBS ${ROOTCLIBS} ${ROOTPLIBS} -lTreePlayer -lGeomPainter -lGed -lRGL -lEve ${SYSLIBS})
AliEveEventManager* AliEveEventManager::fgMaster = 0;
AliEveEventManager* AliEveEventManager::fgCurrent = 0;
+//zmq::context_t* AliEveEventManager::fgSubContext=0;
+//zmq::socket_t* AliEveEventManager::fgSubSock=0;
+
+bool AliEveEventManager::ConnectToServer()
+{
+/*
+ // make a zeromq socket
+ fgSubContext = new zmq::context_t(1);
+ fgSubSock = new zmq::socket_t(*fgSubContext, ZMQ_SUB);
+ fgSubSock->setsockopt(ZMQ_SUBSCRIBE, "", 0); //filter, strlen (filter));
+ fgSubSock->connect("tcp://*:5024");
+ return true;
+ */
+}
+
+/*
+zmq::socket_t* AliEveEventManager::AssertSubscriber()
+{
+ return fgCurrent->fgSubSock;
+}
+*/
+
void AliEveEventManager::InitInternals()
{
// Initialize internal members.
#include <AliEventInfo.h>
+#include <AliESDEvent.h>
+
+//#include <zmq.hpp>
+
+
class AliEveMacroExecutor;
class AliEveEventSelector;
TString GetEventInfoVertical() const;
const AliEventInfo* GetEventInfo();
+ static bool ConnectToServer(); // connect to the events server
+ //static zmq::socket_t* AssertSubscriber();
+
static Int_t CurrentEventId();
static Bool_t HasRunLoader();
static AliRecoParam* fgRecoParam;
static Bool_t fgUniformField; // Track with uniform field.
+ //static zmq::context_t* fgSubContext;
+ //static zmq::socket_t* fgSubSock;
private:
AliEveEventManager(const AliEveEventManager&); // Not implemented
AliEveEventManager& operator=(const AliEveEventManager&); // Not implemented
void alieve_online_init()
{
-
+ printf("alieve_online_init() ...\n");
+
if (gSystem->Getenv("ALICE_ROOT") != 0)
{
gInterpreter->AddIncludePath(Form("%s/MUON", gSystem->Getenv("ALICE_ROOT")));
slot->StopEmbedding("Selections");
// QA viewer
+/*
slot = TEveWindow::CreateWindowInTab(browser->GetTabRight());
slot->StartEmbedding();
new AliQAHistViewer(gClient->GetRoot(), 600, 400, kTRUE);
slot->StopEmbedding("QA histograms");
browser->GetTabRight()->SetTab(1);
-
+*/
browser->StartEmbedding(TRootBrowser::kBottom);
new AliEveEventManagerWindow(AliEveEventManager::GetMaster());
browser->StopEmbedding("EventCtrl");
* full copyright notice. *
**************************************************************************/
-#include "AliDimIntNotifier.h"
#include <TError.h>
-#include <signal.h>
+#include <TSystem.h>
+
+#include "AliDimIntNotifier.h"
//______________________________________________________________________________
// Full description of AliDimIntNotifier
ClassImp(AliDimIntNotifier)
-Long_t AliDimIntNotifier::fgMainThreadId = 0;
-
-void AliDimIntNotifier::SetMainThreadId()
-{
- fgMainThreadId = TThread::SelfId();
-}
-
AliDimIntNotifier::AliDimIntNotifier(const TString& service) :
DimUpdatedInfo(service, -1),
- fReThreader(),
- fNotifyLck(kTRUE),
fLastMessage(-1)
{
- fReThreader.Connect("Timeout()", "AliDimIntNotifier", this, "DimMessage()");
-}
-
-void AliDimIntNotifier::StartTimer()
-{
- fReThreader.Reset();
- fReThreader.TurnOn();
- pthread_kill((pthread_t)fgMainThreadId, SIGALRM);
-}
-void AliDimIntNotifier::StopTimer()
-{
- fReThreader.TurnOff();
}
void AliDimIntNotifier::infoHandler()
{
- // Handle DIM message
-
- fNotifyLck.Lock();
- fLastMessage = getData() ? getInt() : -1;
- if (TThread::SelfId() != fgMainThreadId)
- {
- StartTimer();
- }
- else
- {
- ::Warning("DIMinfoHandler", "DIM message received from CINT thread.");
- DimMessage();
- }
- fNotifyLck.UnLock();
-}
-
-void AliDimIntNotifier::infoHandlerTest(Int_t fake)
-{
- // Fake handler for testing.
-
- fNotifyLck.Lock();
- fLastMessage = fake;
- if (TThread::SelfId() != fgMainThreadId)
- {
- StartTimer();
- }
- else
- {
- Warning("infoHandlerTest", "Was called from CINT thread ...");
- DimMessage();
- }
- fNotifyLck.UnLock();
+ // Handle DIM message
+ fLastMessage = getData() ? getInt() : -1;
+ DimMessage(fLastMessage);
}
void AliDimIntNotifier::DimMessage(Int_t)
{
- StopTimer();
+
if (fLastMessage != -1)
{
Emit("DimMessage(Int_t)", fLastMessage);
}
+ gSystem->ProcessEvents();
}
#ifndef AliDimIntNotifier_H
#define AliDimIntNotifier_H
-#include <TObject.h>
#include <TQObject.h>
-#include <TMutex.h>
-#include <TCondition.h>
-#include <TTimer.h>
-
#ifdef ALI_DIM
#include <dic.hxx>
#else
// Short description of AliDimIntNotifier
//
-class AliDimIntNotifier : public TObject,
- public TQObject,
+class AliDimIntNotifier : public TQObject,
public DimUpdatedInfo
{
public:
virtual ~AliDimIntNotifier() {}
void infoHandler();
- void infoHandlerTest(Int_t fake);
-
- void DimMessage(Int_t=-1); // *SIGNAL*
-
- static void SetMainThreadId();
+ void DimMessage(Int_t mess=-1); // *SIGNAL*
private:
AliDimIntNotifier(const AliDimIntNotifier&); // Not implemented
AliDimIntNotifier& operator=(const AliDimIntNotifier&); // Not implemented
- void StartTimer();
- void StopTimer();
-
- TTimer fReThreader;
- TMutex fNotifyLck;
-
Int_t fLastMessage;
- static Long_t fgMainThreadId;
-
ClassDef(AliDimIntNotifier, 0);
};
--- /dev/null
+// Author: Mihai Niculescu 2013
+
+/**************************************************************************
+ * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+#include <TEnv.h>
+#include <TObjString.h>
+#include <TString.h>
+#include <TSystem.h>
+
+#include <TGButton.h>
+#include <TGLabel.h>
+#include <TGMsgBox.h>
+#include <TGTab.h>
+#include <TGTextEntry.h>
+
+#include <AliReconstruction.h>
+
+#include "AliEventServerUtil.h"
+#include "AliEventServerPreferencesWindow.h"
+
+//_________________________________________________________
+ClassImp(AliEventServerPreferencesWindow)
+AliEventServerPreferencesWindow::AliEventServerPreferencesWindow(const TGWindow* p, const char* window_title)
+ : TGTransientFrame(gClient->GetRoot(), p),
+ fTab(0),
+ fEntryServerHost(0),
+ fEntryServerPort(0),
+ fEntryCDBDefaultStorage(0),
+ fEntryCDBSpecStoragePath1(0),
+ fEntryCDBSpecStorageValue1(0),
+ fEntryCDBSpecStoragePath2(0),
+ fEntryCDBSpecStorageValue2(0),
+ fEntryCDBSpecStoragePath3(0),
+ fEntryCDBSpecStorageValue3(0),
+ fEntryRecoRunQA(0),
+ fEntryRecoQARefDefStorage(0),
+ fChkRecoRunGlobalQA(0),
+ fChkRecoRunPlaneEff(0),
+ fChkRecoWriteESDf(0),
+ fChkRecoWriteAlignment(0),
+ fChkRecoCleanESD(0),
+ fDetectors(0),
+ fEntryLogbookHost(0),
+ fEntryLogbookPort(0),
+ fEntryLogbookDB(0),
+ fEntryLogbookUser(0),
+ fEntryLogbookPass(0)
+{
+ SetCleanup(kDeepCleanup);
+ SetWindowName(window_title);
+
+ // Tab Preferences
+ fTab = new TGTab(this);
+ TGCompositeFrame* tab1 = fTab->AddTab("Server");
+ TGCompositeFrame* tab2 = fTab->AddTab("Reconstruction");
+ TGCompositeFrame* tab3 = fTab->AddTab("Logbook");
+
+ SetupServerTab(tab1);
+ SetupRecoTab(tab2);
+ SetupLogbookTab(tab3);
+
+ // dialog buttons
+ TGHorizontalFrame* hf = new TGHorizontalFrame(this);
+ TGTextButton* btDefaults = new TGTextButton(hf, "Restore Defaults");
+ TGTextButton* btCancel = new TGTextButton(hf, "Cancel");
+ TGTextButton* btApply = new TGTextButton(hf, "Apply");
+
+ btDefaults->Connect("Clicked()", "AliEventServerPreferencesWindow", this, "onRestoreDefaults()");
+ btCancel->Connect("Clicked()", "AliEventServerPreferencesWindow", this, "onCancel()");
+ btApply->Connect("Clicked()", "AliEventServerPreferencesWindow", this, "onApply()");
+
+ hf->AddFrame(btDefaults, new TGLayoutHints(kLHintsNormal) );
+ hf->AddFrame(btApply, new TGLayoutHints(kLHintsRight) );
+ hf->AddFrame(btCancel, new TGLayoutHints(kLHintsRight) );
+
+
+ // Add Tab Widget and Dialog buttons to Main Window
+ AddFrame(fTab, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY));
+ AddFrame(hf, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+
+ if(ReadSettings()!=0) Info("AliEventServerPreferencesWindow::AliEventServerPreferencesWindow", "Problems while reading settings from file!\n");
+
+ SetMWMHints(kMWMDecorAll | kMWMDecorResizeH | kMWMDecorMaximize |
+ kMWMDecorMinimize | kMWMDecorMenu,
+ kMWMFuncAll | kMWMFuncResize | kMWMFuncMaximize |
+ kMWMFuncMinimize,
+ kMWMInputModeless);
+
+ MapSubwindows();
+ Resize();
+ MapWindow();
+
+ gClient->WaitFor(this);
+}
+
+AliEventServerPreferencesWindow::~AliEventServerPreferencesWindow()
+{
+ delete fDetectors;
+ fDetectors=0;
+}
+
+/*********************/
+/* Server Settings Tab */
+/*********************/
+void AliEventServerPreferencesWindow::SetupServerTab(TGCompositeFrame* tab)
+{
+ TGHorizontalFrame *t2hf = new TGHorizontalFrame(tab, 1, 20);
+ TGLabel* lbServerHost = new TGLabel(t2hf, "Host:");
+ t2hf->AddFrame(lbServerHost, new TGLayoutHints(kLHintsCenterY));
+
+ fEntryServerHost = new TGTextEntry(t2hf, "tcp://*");
+ t2hf->AddFrame(fEntryServerHost, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+
+ TGLabel* lbServerPort = new TGLabel(t2hf, "Port:");
+ t2hf->AddFrame(lbServerPort, new TGLayoutHints(kLHintsCenterY));
+
+ fEntryServerPort = new TGTextEntry(t2hf, "5024");
+ fEntryServerPort->SetMaxLength(5);
+ t2hf->AddFrame(fEntryServerPort, new TGLayoutHints(kLHintsNormal));
+
+ tab->AddFrame(t2hf, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+}
+
+ /*******************/
+ /* Reco Settings Tab */
+ /*******************/
+void AliEventServerPreferencesWindow::SetupRecoTab(TGCompositeFrame* tab)
+{
+ /* CDB Manager Group Frame */
+ TGGroupFrame* grCDBMan = new TGGroupFrame(tab, "CDB Manager");
+ // Default Storage Frame
+ TGHorizontalFrame *hfCDBDefaultStorage = new TGHorizontalFrame(grCDBMan, 1, 20);
+ TGLabel* lbCDBDefaultStorage = new TGLabel(hfCDBDefaultStorage, "Default Storage:");
+ fEntryCDBDefaultStorage = new TGTextEntry(hfCDBDefaultStorage, "local:///local/cdb");
+
+ hfCDBDefaultStorage->AddFrame(lbCDBDefaultStorage, new TGLayoutHints(kLHintsCenterY));
+ hfCDBDefaultStorage->AddFrame(fEntryCDBDefaultStorage, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+
+ // Specific Storage 1 Frame
+ TGHorizontalFrame *hfCDBSpecStorage1 = new TGHorizontalFrame(grCDBMan, 1, 20);
+ TGLabel* lbCDBSpecStorage1 = new TGLabel(hfCDBSpecStorage1, "Specific Storage:");
+ fEntryCDBSpecStoragePath1 = new TGTextEntry(hfCDBSpecStorage1, "GRP/GRP/Data");
+ fEntryCDBSpecStorageValue1 = new TGTextEntry(hfCDBSpecStorage1, "");
+
+ hfCDBSpecStorage1->AddFrame(lbCDBSpecStorage1, new TGLayoutHints(kLHintsCenterY));
+ hfCDBSpecStorage1->AddFrame(fEntryCDBSpecStoragePath1, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ hfCDBSpecStorage1->AddFrame(fEntryCDBSpecStorageValue1, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+
+ // Specific Storage 2 Frame
+ TGHorizontalFrame *hfCDBSpecStorage2 = new TGHorizontalFrame(grCDBMan, 1, 20);
+ TGLabel* lbCDBSpecStorage2 = new TGLabel(hfCDBSpecStorage2, "Specific Storage:");
+ fEntryCDBSpecStoragePath2 = new TGTextEntry(hfCDBSpecStorage2, "GRP/CTP/Config");
+ fEntryCDBSpecStorageValue2 = new TGTextEntry(hfCDBSpecStorage2, "");
+
+ hfCDBSpecStorage2->AddFrame(lbCDBSpecStorage2, new TGLayoutHints(kLHintsCenterY));
+ hfCDBSpecStorage2->AddFrame(fEntryCDBSpecStoragePath2, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ hfCDBSpecStorage2->AddFrame(fEntryCDBSpecStorageValue2, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+
+ // Specific Storage 3 Frame
+ TGHorizontalFrame *hfCDBSpecStorage3 = new TGHorizontalFrame(grCDBMan, 1, 20);
+ TGLabel* lbCDBSpecStorage3 = new TGLabel(hfCDBSpecStorage3, "Specific Storage:");
+ fEntryCDBSpecStoragePath3 = new TGTextEntry(hfCDBSpecStorage3, "");
+ fEntryCDBSpecStorageValue3 = new TGTextEntry(hfCDBSpecStorage3, "");
+
+ hfCDBSpecStorage3->AddFrame(lbCDBSpecStorage3, new TGLayoutHints(kLHintsCenterY));
+ hfCDBSpecStorage3->AddFrame(fEntryCDBSpecStoragePath3, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ hfCDBSpecStorage3->AddFrame(fEntryCDBSpecStorageValue3, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+
+ grCDBMan->AddFrame(hfCDBDefaultStorage, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ grCDBMan->AddFrame(hfCDBSpecStorage1, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ grCDBMan->AddFrame(hfCDBSpecStorage2, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ grCDBMan->AddFrame(hfCDBSpecStorage3, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+
+ tab->AddFrame(grCDBMan, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ grCDBMan->Resize();
+
+ /* Reconstruction Settings Group Frame */
+ TGGroupFrame* grRecoFrame = new TGGroupFrame(tab, "Reconstruction");
+ // SetRunQA
+ TGHorizontalFrame *hfRecoRunQA = new TGHorizontalFrame(grRecoFrame, 1, 20);
+ TGLabel* lbRecoRunQA = new TGLabel(hfRecoRunQA, "Run QA:");
+ fEntryRecoRunQA = new TGTextEntry(hfRecoRunQA, ":");
+
+ hfRecoRunQA->AddFrame( lbRecoRunQA, new TGLayoutHints(kLHintsCenterY));
+ hfRecoRunQA->AddFrame( fEntryRecoRunQA, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+
+ // QARef Default Storage
+ TGHorizontalFrame *hfRecoQARefDefStorage = new TGHorizontalFrame(grRecoFrame, 1, 20);
+ TGLabel* lbRecoQARefDefStorage= new TGLabel(hfRecoQARefDefStorage, "QARef Default Storage:");
+ fEntryRecoQARefDefStorage = new TGTextEntry(hfRecoQARefDefStorage, "local://$ALICE_ROOT/QAref");
+
+ hfRecoQARefDefStorage->AddFrame( lbRecoQARefDefStorage, new TGLayoutHints(kLHintsCenterY));
+ hfRecoQARefDefStorage->AddFrame( fEntryRecoQARefDefStorage, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+
+ // RunGlobalQA
+ fChkRecoRunGlobalQA = new TGCheckButton(grRecoFrame, "Run Global QA");
+
+ // Plane Efficiency Evalution
+ fChkRecoRunPlaneEff= new TGCheckButton(grRecoFrame, "Plane Efficiency Evaluation");
+
+ // Write ESD Friend
+ fChkRecoWriteESDf= new TGCheckButton(grRecoFrame, "Write ESD friend");
+
+ // Write Alignement Data
+ fChkRecoWriteAlignment= new TGCheckButton(grRecoFrame, "Write Alignment Data");
+
+ // Clean ESD
+ fChkRecoCleanESD= new TGCheckButton(grRecoFrame, "Clean ESD");
+
+ // Participating Detectors
+ TGGroupFrame* grRecoDetFrame = new TGGroupFrame(grRecoFrame, "Participating Detectors");
+ TGHorizontalFrame *hfRecoDets = new TGHorizontalFrame(grRecoDetFrame, 1, 20);
+ TGTextButton* btRecoCheckAll = new TGTextButton(hfRecoDets, "Check All");
+ TGTextButton* btRecoUnCheckAll = new TGTextButton(hfRecoDets, "Uncheck All");
+
+ btRecoCheckAll->Connect("Clicked()", "AliEventServerPreferencesWindow", this, "onCheckAllDetectors()");
+ btRecoUnCheckAll->Connect("Clicked()", "AliEventServerPreferencesWindow", this, "onUnCheckAllDetectors()");
+
+ hfRecoDets->AddFrame( btRecoCheckAll, new TGLayoutHints(kLHintsNormal));
+ hfRecoDets->AddFrame( btRecoUnCheckAll, new TGLayoutHints(kLHintsNormal));
+
+ grRecoDetFrame->AddFrame(hfRecoDets, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+
+ // get detectors names from AliReconstruction
+ const char** detnames= AliReconstruction::GetDetectorNames();
+ TGCompositeFrame* cfDetectors = new TGCompositeFrame(grRecoDetFrame);
+ cfDetectors->SetLayoutManager(new TGMatrixLayout(cfDetectors, 0, 4, 10));
+
+ fDetectors = new TObjArray;
+ for(int i=0; i< AliReconstruction::kNDetectors; i++){
+ TGCheckButton* chkRecoDet = new TGCheckButton(cfDetectors, detnames[i]);
+ cfDetectors->AddFrame(chkRecoDet, new TGLayoutHints(kLHintsNormal));
+ fDetectors->Add(chkRecoDet);
+ }
+
+ grRecoDetFrame->AddFrame(cfDetectors, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ grRecoDetFrame->Resize();
+
+ grRecoFrame->AddFrame(hfRecoRunQA, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ grRecoFrame->AddFrame(hfRecoQARefDefStorage, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ grRecoFrame->AddFrame(fChkRecoRunGlobalQA, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ grRecoFrame->AddFrame(fChkRecoRunPlaneEff, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ grRecoFrame->AddFrame(fChkRecoWriteESDf, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ grRecoFrame->AddFrame(fChkRecoWriteAlignment, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ grRecoFrame->AddFrame(fChkRecoCleanESD, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ grRecoFrame->AddFrame(grRecoDetFrame, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+
+ tab->AddFrame(grRecoFrame, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY));
+ grRecoFrame->Resize();
+}
+
+
+/***********************/
+/* Logbook Settings Tab */
+/***********************/
+void AliEventServerPreferencesWindow::SetupLogbookTab(TGCompositeFrame* tab)
+{
+ // host and port
+ TGCompositeFrame* cfLogbook = new TGCompositeFrame(tab);
+ cfLogbook->SetLayoutManager(new TGMatrixLayout(cfLogbook, 0, 2));
+
+ TGLabel* lbLogbookHost = new TGLabel(cfLogbook, "Host:");
+ fEntryLogbookHost = new TGTextEntry(cfLogbook, "pcaldbl501");
+ fEntryLogbookHost->Resize(150,0);
+ TGLabel* lbLogbookPort = new TGLabel(cfLogbook, "Port:");
+ fEntryLogbookPort = new TGTextEntry(cfLogbook, "3306");
+ fEntryLogbookPort->SetMaxLength(5);
+
+ // database name
+ TGLabel* lbLogbookDB = new TGLabel(cfLogbook, "Database:");
+ fEntryLogbookDB = new TGTextEntry(cfLogbook, "logbook");
+ fEntryLogbookDB->Resize(150,0);
+
+ // username
+ TGLabel* lbLogbookUser = new TGLabel(cfLogbook, "User:");
+ fEntryLogbookUser = new TGTextEntry(cfLogbook, "dqm");
+ fEntryLogbookUser->Resize(150,0);
+
+ // password
+ TGLabel* lbLogbookPass = new TGLabel(cfLogbook, "Password:");
+ fEntryLogbookPass = new TGTextEntry(cfLogbook, "dqm123");
+ fEntryLogbookPass->SetEchoMode(TGTextEntry::kPassword);
+ fEntryLogbookPass->Resize(150,0);
+
+ cfLogbook->AddFrame(lbLogbookHost, new TGLayoutHints(kLHintsCenterY));
+ cfLogbook->AddFrame(fEntryLogbookHost, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ cfLogbook->AddFrame(lbLogbookPort, new TGLayoutHints(kLHintsCenterY));
+ cfLogbook->AddFrame(fEntryLogbookPort, new TGLayoutHints(kLHintsNormal));
+ cfLogbook->AddFrame(lbLogbookDB, new TGLayoutHints(kLHintsCenterY));
+ cfLogbook->AddFrame(fEntryLogbookDB, new TGLayoutHints(kLHintsNormal));
+ cfLogbook->AddFrame(lbLogbookUser, new TGLayoutHints(kLHintsCenterY));
+ cfLogbook->AddFrame(fEntryLogbookUser, new TGLayoutHints(kLHintsNormal));
+ cfLogbook->AddFrame(lbLogbookPass, new TGLayoutHints(kLHintsCenterY));
+ cfLogbook->AddFrame(fEntryLogbookPass, new TGLayoutHints(kLHintsNormal));
+
+ tab->AddFrame(cfLogbook, new TGLayoutHints(kLHintsNormal));
+}
+
+void AliEventServerPreferencesWindow::onRestoreDefaults()
+{
+ int retCode;
+ const char* messageInfo = "Are you sure you want to restore the default settings?\n";
+
+ new TGMsgBox(gClient->GetRoot(), this, "Restore Default Settings?", messageInfo, kMBIconQuestion, kMBNo|kMBYes, &retCode);
+
+ if(retCode==kMBNo) return;
+ RestoreDefaults();
+}
+
+void AliEventServerPreferencesWindow::onCancel()
+{
+ SendCloseMessage();
+}
+
+void AliEventServerPreferencesWindow::onApply()
+{
+ if(WriteSettings()==0){// success!
+ const char* messageInfo = "The changes were saved.\n"
+ "Notice: They will take effect when a new run starts or\n"
+ "after the reconstruction is restarted (if it is already running)";
+
+ new TGMsgBox(gClient->GetRoot(), this, "New Settings Notice", messageInfo, kMBIconExclamation, kMBOk);
+
+ SendCloseMessage();
+ }
+ else{
+ const char* messageInfo = "The changes could not be saved!\n"
+ "Check if you have permissions to write to that location.";
+
+ new TGMsgBox(gClient->GetRoot(), this, "New Settings Notice", messageInfo, kMBIconExclamation, kMBOk);
+ }
+
+}
+
+void AliEventServerPreferencesWindow::onCheckAllDetectors()
+{
+ for(int i=0; i<fDetectors->GetEntries(); ++i){
+ TGCheckButton* bt = (TGCheckButton*)fDetectors->At(i);
+ bt->SetOn(kTRUE);
+ }
+}
+
+void AliEventServerPreferencesWindow::onUnCheckAllDetectors()
+{
+ for(int i=0; i<fDetectors->GetEntries(); ++i){
+ TGCheckButton* bt = (TGCheckButton*)fDetectors->At(i);
+ bt->SetOn(kFALSE);
+ }
+}
+
+Int_t AliEventServerPreferencesWindow::ReadSettings()
+{
+ TEnv settings;
+ int readStatus = settings.ReadFile(Form("%s/MONITOR/%s", gSystem->Getenv("ALICE_ROOT"), ALIEVENTSERVER_CONF), kEnvLocal);
+ //check if there was an error reading the file
+ if(readStatus!=0) return readStatus;
+
+ // server settings
+ fEntryServerHost->SetText( settings.GetValue("server.host", DEFAULT_SERVER_HOST), kFALSE);
+ fEntryServerPort->SetText( Form("%d", settings.GetValue("server.port", DEFAULT_SERVER_PORT)), kFALSE);
+
+ // reco settings
+ fEntryCDBDefaultStorage->SetText( settings.GetValue( "cdb.defaultStorage", DEFAULT_CDB_STORAGE), kFALSE);
+ fEntryCDBSpecStoragePath1->SetText( settings.GetValue( "cdb.specificStoragePath1", DEFAULT_CDB_SPEC_STORAGE_PATH1), kFALSE);
+ fEntryCDBSpecStorageValue1->SetText( settings.GetValue( "cdb.specificStorageValue1", DEFAULT_CDB_SPEC_STORAGE_VALUE1), kFALSE);
+ fEntryCDBSpecStoragePath2->SetText( settings.GetValue( "cdb.specificStoragePath2", DEFAULT_CDB_SPEC_STORAGE_PATH2), kFALSE);
+ fEntryCDBSpecStorageValue2->SetText(settings.GetValue( "cdb.specificStorageValue2", DEFAULT_CDB_SPEC_STORAGE_VALUE2), kFALSE);
+ fEntryCDBSpecStoragePath3->SetText( settings.GetValue( "cdb.specificStoragePath3", DEFAULT_CDB_SPEC_STORAGE_PATH3), kFALSE);
+ fEntryCDBSpecStorageValue3->SetText(settings.GetValue( "cdb.specificStorageValue3", DEFAULT_CDB_SPEC_STORAGE_VALUE3), kFALSE);
+ fEntryRecoRunQA->SetText( settings.GetValue( "qa.runDetectors", DEFAULT_QA_RUN), kFALSE );
+ fEntryRecoQARefDefStorage->SetText(settings.GetValue( "qa.defaultStorage",DEFAULT_QAREF_STORAGE), kFALSE);
+ fChkRecoRunGlobalQA->SetOn(settings.GetValue( "qa.runGlobal", DEFAULT_QA_RUN_GLOBAL), kFALSE);
+ fChkRecoRunPlaneEff->SetOn(settings.GetValue( "reco.runPlaneEff", DEFAULT_RECO_RUN_PLANE_EFF), kFALSE);
+ fChkRecoWriteESDf->SetOn(settings.GetValue( "reco.writeESDfriend", DEFAULT_RECO_WRITE_ESDF), kFALSE);
+ fChkRecoWriteAlignment->SetOn(settings.GetValue( "reco.writeAlignment",DEFAULT_RECO_WRITE_ALIGN), kFALSE);
+ fChkRecoCleanESD->SetOn(settings.GetValue( "reco.cleanESD",DEFAULT_RECO_CLEAN_ESD), kFALSE);
+
+ // parse reco run detectors from string
+ TString strRunDetectors(settings.GetValue( "reco.detectors", DEFAULT_RECO_DETECTORS) );
+ TObjArray* arrRecoDets = strRunDetectors.Tokenize(" ");
+
+ for(int i=0; i<arrRecoDets->GetEntries(); ++i){
+ TObjString* objStr = (TObjString*)arrRecoDets->At(i);
+ if(objStr->GetString().BeginsWith("-")){ // detector is disabled
+ for(int j=0; j<fDetectors->GetEntries();++j){
+ TGCheckButton* bt = (TGCheckButton*)fDetectors->At(j);
+ TString btTitle(Form("-%s",bt->GetTitle()));
+ if(btTitle.CompareTo(objStr->GetString())==0) {// match
+ bt->SetOn(kFALSE); // uncheck detector button
+ break;
+ }
+ }
+ }
+ else if(objStr->GetString().CompareTo("ALL")==0){
+ onCheckAllDetectors();
+ }
+ else{ // detector is enabled
+ for(int j=0; j<fDetectors->GetEntries();++j){
+ TGCheckButton* bt = (TGCheckButton*)fDetectors->At(j);
+ TString btTitle(bt->GetTitle());
+ if(btTitle.CompareTo(objStr->GetString())==0) {// match
+ bt->SetOn(kTRUE); // check detector
+ break;
+ }
+ }
+ }
+ }
+
+ // logbook settings
+ fEntryLogbookHost->SetText( settings.GetValue("logbook.host", DEFAULT_LOGBOOK_HOST), kFALSE);
+ fEntryLogbookPort->SetText( Form("%d", settings.GetValue("logbook.port", DEFAULT_LOGBOOK_PORT)), kFALSE);
+ fEntryLogbookDB->SetText( settings.GetValue("logbook.db", DEFAULT_LOGBOOK_DB), kFALSE);
+ fEntryLogbookUser->SetText( settings.GetValue("logbook.user", DEFAULT_LOGBOOK_USER), kFALSE);
+ fEntryLogbookPass->SetText( settings.GetValue("logbook.pass", DEFAULT_LOGBOOK_PASS), kFALSE);
+
+ return readStatus;
+}
+
+// write settings to a rootrc file
+// returns 0 in case of success, -1 in case of error
+Int_t AliEventServerPreferencesWindow::WriteSettings()
+{
+ TEnv settings;
+ // server settings
+ settings.SetValue("server.host", fEntryServerHost->GetText());
+ settings.SetValue("server.port", TString(fEntryServerPort->GetText()).Atoi());
+
+ // reco settings
+ settings.SetValue( "cdb.defaultStorage", fEntryCDBDefaultStorage->GetText());
+ settings.SetValue( "cdb.specificStoragePath1", fEntryCDBSpecStoragePath1->GetText());
+ settings.SetValue( "cdb.specificStorageValue1", fEntryCDBSpecStorageValue1->GetText());
+ settings.SetValue( "cdb.specificStoragePath2", fEntryCDBSpecStoragePath2->GetText());
+ settings.SetValue( "cdb.specificStorageValue2", fEntryCDBSpecStorageValue2->GetText());
+ settings.SetValue( "cdb.specificStoragePath3", fEntryCDBSpecStoragePath3->GetText());
+ settings.SetValue( "cdb.specificStorageValue3", fEntryCDBSpecStorageValue3->GetText());
+ settings.SetValue( "qa.runDetectors", fEntryRecoRunQA->GetText());
+ settings.SetValue( "qa.defaultStorage", fEntryRecoQARefDefStorage->GetText());
+ settings.SetValue( "qa.runGlobal", fChkRecoRunGlobalQA->IsOn());
+ settings.SetValue( "reco.runPlaneEff", fChkRecoRunPlaneEff->IsOn());
+ settings.SetValue( "reco.writeESDfriend", fChkRecoWriteESDf->IsOn());
+ settings.SetValue( "reco.writeAlignment", fChkRecoWriteAlignment->IsOn());
+ settings.SetValue( "reco.cleanESD", fChkRecoCleanESD->IsOn());
+
+ // will write reco run detectors as a single string
+ TObjArray checkedDetectors;
+ TObjArray uncheckedDetectors;
+ TString strRunDetectors;
+
+ for(int i=0; i<fDetectors->GetEntries(); ++i){
+ TGCheckButton* bt = (TGCheckButton*)fDetectors->At(i);
+ if(bt->IsOn()){
+ checkedDetectors.Add(bt);
+ }
+ else{
+ uncheckedDetectors.Add(bt);
+ }
+ }
+
+ int nChkDets = checkedDetectors.GetEntries();
+ int nUnChkDets = uncheckedDetectors.GetEntries();
+ if(nChkDets>=nUnChkDets){
+ strRunDetectors="ALL ";
+ for(int i=0; i<nUnChkDets; ++i ){
+ strRunDetectors.Append( Form(" -%s",uncheckedDetectors.At(i)->GetTitle()) );
+ }
+ }
+ else {
+ for(int i=0; i<nChkDets; ++i ){
+ strRunDetectors.Append( Form(" %s",checkedDetectors.At(i)->GetTitle()) );
+ }
+ }
+
+ settings.SetValue( "reco.detectors", strRunDetectors.Data());
+
+ // logbook settings
+ settings.SetValue("logbook.host", fEntryLogbookHost->GetText());
+ settings.SetValue("logbook.port", TString(fEntryLogbookPort->GetText()).Atoi());
+ settings.SetValue("logbook.db", fEntryLogbookDB->GetText());
+ settings.SetValue("logbook.user", fEntryLogbookUser->GetText());
+ settings.SetValue("logbook.pass", fEntryLogbookPass->GetText());
+
+ return settings.WriteFile(Form("%s/MONITOR/%s", gSystem->Getenv("ALICE_ROOT"), ALIEVENTSERVER_CONF));
+}
+
+void AliEventServerPreferencesWindow::RestoreDefaults()
+{
+ // server settings
+ fEntryServerHost->SetText( DEFAULT_SERVER_HOST, kFALSE);
+ fEntryServerPort->SetText( Form("%d", DEFAULT_SERVER_PORT), kFALSE);
+
+ // reco settings
+ fEntryCDBDefaultStorage->SetText( DEFAULT_CDB_STORAGE, kFALSE);
+ fEntryCDBSpecStoragePath1->SetText( DEFAULT_CDB_SPEC_STORAGE_PATH1, kFALSE);
+ fEntryCDBSpecStorageValue1->SetText( DEFAULT_CDB_SPEC_STORAGE_VALUE1, kFALSE);
+ fEntryCDBSpecStoragePath2->SetText( DEFAULT_CDB_SPEC_STORAGE_PATH2, kFALSE);
+ fEntryCDBSpecStorageValue2->SetText(DEFAULT_CDB_SPEC_STORAGE_VALUE2, kFALSE);
+ fEntryCDBSpecStoragePath3->SetText( DEFAULT_CDB_SPEC_STORAGE_PATH3, kFALSE);
+ fEntryCDBSpecStorageValue3->SetText( DEFAULT_CDB_SPEC_STORAGE_VALUE3, kFALSE);
+ fEntryRecoRunQA->SetText( DEFAULT_QA_RUN, kFALSE );
+ fEntryRecoQARefDefStorage->SetText(DEFAULT_QAREF_STORAGE, kFALSE);
+ fChkRecoRunGlobalQA->SetOn(DEFAULT_QA_RUN_GLOBAL, kFALSE);
+ fChkRecoRunPlaneEff->SetOn(DEFAULT_RECO_RUN_PLANE_EFF, kFALSE);
+ fChkRecoWriteESDf->SetOn(DEFAULT_RECO_WRITE_ESDF, kFALSE);
+ fChkRecoWriteAlignment->SetOn(DEFAULT_RECO_WRITE_ALIGN, kFALSE);
+ fChkRecoCleanESD->SetOn(DEFAULT_RECO_CLEAN_ESD, kFALSE);
+
+ // parse reco run detectors from string
+ TString strRunDetectors( DEFAULT_RECO_DETECTORS );
+ TObjArray* arrRecoDets = strRunDetectors.Tokenize(" ");
+
+ for(int i=0; i<arrRecoDets->GetEntries(); ++i){
+ TObjString* objStr = (TObjString*)arrRecoDets->At(i);
+ if(objStr->GetString().BeginsWith("-")){ // detector is disabled
+ for(int j=0; j<fDetectors->GetEntries();++j){
+ TGCheckButton* bt = (TGCheckButton*)fDetectors->At(j);
+ TString btTitle(Form("-%s",bt->GetTitle()));
+ if(btTitle.CompareTo(objStr->GetString())==0) {// match
+ bt->SetOn(kFALSE); // uncheck detector button
+ break;
+ }
+ }
+ }
+ else if(objStr->GetString().CompareTo("ALL")==0){
+ onCheckAllDetectors();
+ }
+ else{ // detector is enabled
+ for(int j=0; j<fDetectors->GetEntries();++j){
+ TGCheckButton* bt = (TGCheckButton*)fDetectors->At(j);
+ TString btTitle(bt->GetTitle());
+ if(btTitle.CompareTo(objStr->GetString())==0) {// match
+ bt->SetOn(kTRUE); // check detector
+ break;
+ }
+ }
+ }
+ }
+
+ // logbook settings
+ fEntryLogbookHost->SetText( DEFAULT_LOGBOOK_HOST, kFALSE);
+ fEntryLogbookPort->SetText( Form("%d", DEFAULT_LOGBOOK_PORT), kFALSE);
+ fEntryLogbookDB->SetText( DEFAULT_LOGBOOK_DB, kFALSE);
+ fEntryLogbookUser->SetText( DEFAULT_LOGBOOK_USER, kFALSE);
+ fEntryLogbookPass->SetText( DEFAULT_LOGBOOK_PASS, kFALSE);
+}
--- /dev/null
+// Author: Mihai Niculescu 2013
+
+/**************************************************************************
+ * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+#ifndef AliEventServerPreferencesWindow_H
+#define AliEventServerPreferencesWindow_H
+
+
+#include <TGFrame.h>
+
+class TObjArray;
+class TGCheckButton;
+class TGTab;
+class TGTextEntry;
+class TGWindow;
+
+class AliEventServerPreferencesWindow : public TGTransientFrame
+{
+public:
+ AliEventServerPreferencesWindow(const TGWindow* parent, const char* window_title);
+ virtual ~AliEventServerPreferencesWindow();
+
+ // SLOTS
+ void onApply();
+ void onCancel();
+ void onRestoreDefaults();
+ void onCheckAllDetectors();
+ void onUnCheckAllDetectors();
+
+protected:
+ Int_t ReadSettings();
+ Int_t WriteSettings();
+ void RestoreDefaults();
+
+ TGTab* fTab;
+ /* Server Settings Tab */
+ TGTextEntry* fEntryServerHost;
+ TGTextEntry* fEntryServerPort;
+
+ /* Reconstruction Settings Tab */
+ // CDB Manager widgets
+ TGTextEntry* fEntryCDBDefaultStorage;
+ TGTextEntry* fEntryCDBSpecStoragePath1;
+ TGTextEntry* fEntryCDBSpecStorageValue1;
+ TGTextEntry* fEntryCDBSpecStoragePath2;
+ TGTextEntry* fEntryCDBSpecStorageValue2;
+ TGTextEntry* fEntryCDBSpecStoragePath3;
+ TGTextEntry* fEntryCDBSpecStorageValue3;
+ // Reconstruction widgets
+ TGTextEntry* fEntryRecoRunQA;
+ TGTextEntry* fEntryRecoQARefDefStorage;
+ TGCheckButton* fChkRecoRunGlobalQA;
+ TGCheckButton* fChkRecoRunPlaneEff;
+ TGCheckButton* fChkRecoWriteESDf;
+ TGCheckButton* fChkRecoWriteAlignment;
+ TGCheckButton* fChkRecoCleanESD;
+ TObjArray* fDetectors; // array to pointers of TGCheckButtons for detectors
+
+ /* Logbook Tab */
+ TGTextEntry* fEntryLogbookHost;
+ TGTextEntry* fEntryLogbookPort;
+ TGTextEntry* fEntryLogbookDB;
+ TGTextEntry* fEntryLogbookUser;
+ TGTextEntry* fEntryLogbookPass;
+
+private:
+ void SetupServerTab(TGCompositeFrame* tab);
+ void SetupRecoTab(TGCompositeFrame* tab);
+ void SetupLogbookTab(TGCompositeFrame* tab);
+
+ ClassDef(AliEventServerPreferencesWindow,0);
+};
+#endif
--- /dev/null
+#ifndef __ALIEVENTSERVER_UTIL_H__
+#define __ALIEVENTSERVER_UTIL_H__
+
+// Default configuration file
+#define ALIEVENTSERVER_CONF "alieventserver.rootrc"
+
+//______________DEFAULT SETTINGS________________
+#define DEFAULT_SERVER_HOST "tcp://*"
+#define DEFAULT_SERVER_PORT 5024
+#define DEFAULT_SERVER_SAVE_RECO_DIR "reco"
+#define DEFAULT_CDB_STORAGE "local:///local/cdb"
+#define DEFAULT_CDB_SPEC_STORAGE_PATH1 "GRP/GRP/Data"
+#define DEFAULT_CDB_SPEC_STORAGE_VALUE1 ""
+#define DEFAULT_CDB_SPEC_STORAGE_PATH2 "GRP/CTP/Config"
+#define DEFAULT_CDB_SPEC_STORAGE_VALUE2 ""
+#define DEFAULT_CDB_SPEC_STORAGE_PATH3 ""
+#define DEFAULT_CDB_SPEC_STORAGE_VALUE3 ""
+#define DEFAULT_QA_RUN ":"
+#define DEFAULT_QAREF_STORAGE "local://$ALICE_ROOT/QAref"
+#define DEFAULT_QA_RUN_GLOBAL 1
+#define DEFAULT_RECO_RUN_PLANE_EFF 1
+#define DEFAULT_RECO_WRITE_ESDF 1
+#define DEFAULT_RECO_WRITE_ALIGN 1
+#define DEFAULT_RECO_CLEAN_ESD 0
+#define DEFAULT_RECO_DETECTORS "ALL -PHOS -HLT -EMCAL"
+#define DEFAULT_LOGBOOK_HOST "pcaldbl501"
+#define DEFAULT_LOGBOOK_PORT 3306
+#define DEFAULT_LOGBOOK_DB "logbook"
+#define DEFAULT_LOGBOOK_USER "dqm"
+#define DEFAULT_LOGBOOK_PASS "nopass"
+
+#endif /* __ALIEVENTSERVER_UTIL_H__ */
--- /dev/null
+// Author: Mihai Niculesu 2013
+
+/**************************************************************************
+ * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *)
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+#include <TEnv.h>
+#include <TSystem.h>
+
+#include <TSQLServer.h>
+#include <TSQLResult.h>
+#include <TSQLRow.h>
+
+#include <TTimeStamp.h>
+#include <TTimer.h>
+
+#include <TGButton.h>
+#include <TGListBox.h>
+#include <TGTab.h>
+#include <TGTextEntry.h>
+#include <TGToolBar.h>
+#include <TG3DLine.h>
+
+#include <AliLog.h>
+#include <AliReconstruction.h>
+
+#include "AliEventServerUtil.h"
+#include "AliEventServerWindow.h"
+#include "AliEventServerPreferencesWindow.h"
+#include "AliDimIntNotifier.h"
+#include "AliRecoServer.h"
+
+//______________________________________________________________________________
+// Full description of AliEventServerWindow
+//
+
+ClassImp(AliEventServerWindow)
+
+AliEventServerWindow::AliEventServerWindow() :
+ TGMainFrame(gClient->GetRoot(), 400, 400),
+ fRunList(0),
+ fStartServButt(0),
+ fStopServButt(0),
+ fExitButt(0),
+ fRunRunning(0),
+ fRecoServer(0)
+{
+ SetCleanup(kDeepCleanup);
+
+ SetupToolbar();
+
+ fRunList = new TGListBox(this);
+
+ AddFrame(fRunList, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY));
+
+ for(Int_t i=0; i<5; ++i)
+ {
+ fDimSORListener[i] = 0;
+ fDimEORListener[i] = 0;
+ }
+
+ Connect("CloseWindow()", "AliEventServerWindow", this, "onExit()");
+ SetWindowName("ALICE Event Server");
+
+ MapSubwindows();
+ Resize(250,300);
+ MapWindow();
+
+ FillRunsFromDatabase();
+ InitDIMListeners();
+}
+
+AliEventServerWindow::~AliEventServerWindow()
+{
+ // Destructor.
+
+ for (Int_t i = 0; i < 5; ++i)
+ {
+ if(fDimSORListener[i]) delete fDimSORListener[i];
+ if(fDimEORListener[i]) delete fDimEORListener[i];
+
+ fDimSORListener[i] = 0;
+ fDimEORListener[i] = 0;
+ }
+
+}
+
+void AliEventServerWindow::InitDIMListeners()
+{
+ // DIM interface.
+ for (Int_t i = 0; i < 5; ++i)
+ {
+ if (i == 0)
+ {
+ fDimSORListener[i] = new AliDimIntNotifier("/LOGBOOK/SUBSCRIBE/DAQ_SOR_PHYSICS");
+ fDimEORListener[i] = new AliDimIntNotifier("/LOGBOOK/SUBSCRIBE/DAQ_EOR_PHYSICS");
+ }
+ else
+ {
+ fDimSORListener[i] = new AliDimIntNotifier(Form("/LOGBOOK/SUBSCRIBE/DAQ_SOR_PHYSICS_%d", i));
+ fDimEORListener[i] = new AliDimIntNotifier(Form("/LOGBOOK/SUBSCRIBE/DAQ_EOR_PHYSICS_%d", i));
+ }
+
+ fDimSORListener[i]->Connect("DimMessage(Int_t)", "AliEventServerWindow", this, "StartOfRun(Int_t)");
+ fDimEORListener[i]->Connect("DimMessage(Int_t)", "AliEventServerWindow", this, "EndOfRun(Int_t)");
+ }
+
+}
+
+void AliEventServerWindow::FillRunsFromDatabase()
+{
+ TEnv settings(ALIEVENTSERVER_CONF);
+
+ TString dbHost = settings.GetValue("logbook.host", DEFAULT_LOGBOOK_HOST);
+ TString dbPort = Form("%d", settings.GetValue("logbook.port", DEFAULT_LOGBOOK_PORT));
+ TString dbName = settings.GetValue("logbook.db", DEFAULT_LOGBOOK_DB);
+ TString user = settings.GetValue("logbook.user", DEFAULT_LOGBOOK_USER);
+ TString password = settings.GetValue("logbook.pass", DEFAULT_LOGBOOK_PASS);
+
+ TSQLServer* server = TSQLServer::Connect(Form("mysql://%s:%s/%s", dbHost.Data(), dbPort.Data(), dbName.Data()), user.Data(), password.Data());
+ if (!server) {
+ AliWarning("ERROR: Could not connect to DAQ Logbook");
+ return;
+ }
+ TString sqlQuery;
+ TTimeStamp ts;
+ sqlQuery.Form("SELECT run FROM logbook WHERE DAQ_time_start > %u AND DAQ_time_end IS NULL AND partition REGEXP 'PHYSICS.*'",
+ (UInt_t)ts.GetSec()-86400);
+ TSQLResult* result = server->Query(sqlQuery);
+ if (!result)
+ {
+ AliWarning( Form("ERROR: Can't execute query <%s>!", sqlQuery.Data()) );
+ return;
+ }
+ if (result->GetRowCount() != 0)
+ {
+ for (Int_t iRow = 0; iRow < result->GetRowCount(); iRow++)
+ {
+ TSQLRow* row = result->Next();
+ TString runStr = row->GetField(0);
+ if (runStr.IsDigit())
+ StartOfRun(runStr.Atoi());
+ delete row;
+ }
+ }
+ delete result;
+
+}
+
+void AliEventServerWindow::SetupToolbar()
+{
+ TGToolBar* mToolBar = new TGToolBar(this);
+ mToolBar->AddButton(this, new TGPictureButton(mToolBar, Form("%s/MONITOR/icons/start.png", gSystem->Getenv("ALICE_ROOT")), TOOLBUTTON_START ) );
+ mToolBar->AddButton(this, new TGPictureButton(mToolBar, Form("%s/MONITOR/icons/stop.png", gSystem->Getenv("ALICE_ROOT")), TOOLBUTTON_STOP) );
+ mToolBar->AddButton(this, new TGPictureButton(mToolBar, Form("%s/MONITOR/icons/preferences.png", gSystem->Getenv("ALICE_ROOT")), TOOLBUTTON_PREFERENCES) );
+ mToolBar->AddButton(this, new TGPictureButton(mToolBar, Form("%s/MONITOR/icons/exit.png", gSystem->Getenv("ALICE_ROOT")), TOOLBUTTON_EXIT) );
+
+ mToolBar->Connect("Clicked(Int_t)", "AliEventServerWindow", this, "HandleToolBarAction(Int_t)");
+
+ AddFrame(mToolBar, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+ AddFrame(new TGHorizontal3DLine(this), new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
+}
+
+void AliEventServerWindow::HandleToolBarAction(Int_t id)
+{
+ if(id==-1) return;
+
+ switch(id){
+ case TOOLBUTTON_START:{
+ onStartServer();
+ break;
+ }
+ case TOOLBUTTON_STOP:{
+ onStopServer();
+ break;
+ }
+ case TOOLBUTTON_PREFERENCES:{
+ new AliEventServerPreferencesWindow(this, "Settings");
+ break;
+ }
+ case TOOLBUTTON_EXIT:{
+ onExit();
+ break;
+ }
+
+ }
+
+}
+
+/*
+void AliEventServerWindow::FinishedReconstruction(Int_t status)
+{
+// Slot called on termination of child process.
+ Int_t run = fServer->GetRunId();
+
+ Info("FinishedReconstruction", "Reconstruction Thread finished \tRunId:%d \tstatus=%d", run, status);
+
+ mIntInt_i i =fRun2PidMap.find(run);
+ if (i != fRun2PidMap.end())
+ {
+ fRunList->RemoveEntry(run);
+
+ // clean (remove) run's reconstructed directory
+ //gSystem->Exec(Form("rm -rf %s/reco/run%d_%d",gSystem->Getenv("ONLINERECO_BASE_DIR"),run,pid));
+
+ if (status == 0)
+ {
+ fRunList->AddEntrySort(TString::Format("%-20d -- PROCESSED", run), run);
+ }
+ else
+ {
+ fRunList->AddEntrySort(TString::Format("%-20d -- PROCESSED [%d]", run, status), run);
+ }
+ fRunList->Layout();
+
+ }
+ else
+ {
+ Warning("FinishedReconstruction", "Run number %d not registered.", run);
+ }
+
+}
+*/
+//------------------------------------------------------------------------------
+// Private methods
+//------------------------------------------------------------------------------
+
+void AliEventServerWindow::StartReco(Int_t run)
+{
+ AliInfo(Form("Starting Reco for run %d", run));
+
+ TString eventSource = Form("mem://%s/run%d", gSystem->Getenv("ONLINERECO_RAWFILES_DIR"), run);
+
+ if(!fRecoServer) LaunchRecoServer();
+
+ fRecoServer->StartReconstruction(run, eventSource.Data());
+
+ if(fRecoServer->IsListenning()){
+ fRunList->RemoveEntry(run);
+ fRunList->AddEntrySort(TString::Format("%-20d -- RUNNING", run), run);
+ fRunList->Layout();
+ }
+}
+
+
+//------------------------------------------------------------------------------
+// Handlers of DIM signals.
+//------------------------------------------------------------------------------
+
+void AliEventServerWindow::StartOfRun(Int_t run)
+{
+ if(run<=0) return;
+
+ // Slot called from DIM handler on start of run.
+ AliInfo(Form("called for Run %d ", run));
+
+ fRunList->AddEntrySort(TString::Format("%d", run), run);
+ fRunList->Layout();
+ gClient->NeedRedraw(fRunList);
+
+ StartReco(run);
+}
+
+void AliEventServerWindow::EndOfRun(Int_t run)
+{
+ if(run<=0) return;
+
+ // Slot called from DIM handler on stop of run.
+ AliInfo(Form("called for Run %d", run) );
+ if(fRecoServer) fRecoServer->StopReconstruction();
+
+ fRunList->RemoveEntry(run);
+ fRunList->Layout();
+ gClient->NeedRedraw(fRunList);
+}
+
+///------------------------------------------------------------------------------
+// Handlers of button signals.
+//------------------------------------------------------------------------------
+
+void AliEventServerWindow::onStartServer()
+{
+ // Slot called from Start button.
+ AliInfo("Starting server...");
+ if(fRecoServer!=0) StopRecoServer();
+
+ LaunchRecoServer();
+}
+
+void AliEventServerWindow::onStopServer()
+{
+ // Slot called from Stop button.
+ AliInfo("Closing server...");
+
+ StopRecoServer();
+}
+
+void AliEventServerWindow::onExit()
+{
+ AliInfo("Closing server & Exiting...");
+
+ StopRecoServer();
+ CloseWindow();
+
+ gSystem->ExitLoop();
+}
+
+void AliEventServerWindow::LaunchRecoServer()
+{
+ fRecoServer = new AliRecoServer;
+}
+
+bool AliEventServerWindow::StopRecoServer()
+{
+ if(fRecoServer==0) return true;
+
+ AliInfo("Closing server and stoping process...");
+
+ delete fRecoServer;
+ fRecoServer=0;
+
+ return true;
+}
--- /dev/null
+// Author: Mihai Niculesu 2013
+
+/**************************************************************************
+ * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+#ifndef AliEventServerWindow_H
+#define AliEventServerWindow_H
+
+#include <TObject.h>
+#include <TString.h>
+#include <TGFrame.h>
+#include <TGLabel.h>
+
+class TGTextButton;
+class TGCheckButton;
+class TGListBox;
+
+class AliRecoServer;
+class AliDimIntNotifier;
+
+//______________________________________________________________________________
+// Short description of AliEventServerWindow
+//
+
+class AliEventServerWindow : public TGMainFrame
+{
+public:
+enum TOOLBUTTON{
+ TOOLBUTTON_START=1,
+ TOOLBUTTON_STOP,
+ TOOLBUTTON_PREFERENCES,
+ TOOLBUTTON_EXIT
+ };
+
+ AliEventServerWindow();
+ virtual ~AliEventServerWindow();
+
+ //------------------------------------------------------------------------------
+ // Handlers of DIM signals.
+ //------------------------------------------------------------------------------
+
+ void StartOfRun(Int_t run);
+ void EndOfRun(Int_t run);
+
+ //------------------------------------------------------------------------------
+ // Handlers of button signals.
+ //------------------------------------------------------------------------------
+ void onStartServer();
+ void onStopServer();
+ void onExit();
+
+ void HandleToolBarAction(Int_t id=-1);
+
+
+private:
+ AliEventServerWindow(const AliEventServerWindow&); // Not implemented
+ AliEventServerWindow& operator=(const AliEventServerWindow&); // Not implemented
+ void InitDIMListeners();
+ void FillRunsFromDatabase();
+ void SetupToolbar();
+
+ void LaunchRecoServer();
+ void StartReco(Int_t run);
+ bool StopRecoServer();
+
+ // GUI components.
+ TGListBox *fRunList; // List-box for listing current runs.
+ TGTextButton *fStartServButt; // Start server for selected run.
+ TGTextButton *fStopServButt; // Close server for selected run.
+ TGTextButton *fExitButt; // Close server and do Exit.
+
+ // DIM interface. Could do without members and just leak them ...
+ AliDimIntNotifier *fDimSORListener[5]; // DIM listeners for SOR.
+ AliDimIntNotifier *fDimEORListener[5]; // DIM listeners for EOR.
+
+ // server state & process management
+ Int_t fRunRunning; // Run which is executed.
+ AliRecoServer* fRecoServer;
+
+
+ ClassDef(AliEventServerWindow, 0);
+};
+
+#endif
-// @(#)root/eve:$Id$
-// Author: Matevz Tadel 2007
-
-/**************************************************************************
- * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *)
- * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
- * full copyright notice. *
- **************************************************************************/
-
-#include "AliOnlineReco.h"
-#include "AliChildProcTerminator.h"
-#include "AliDimIntNotifier.h"
-#include "AliCDBManager.h"
-#include "AliGRPPreprocessor.h"
-
-#include <TTimer.h>
-
-#include <TGListBox.h>
-#include <TGButton.h>
-
-#include <TInterpreter.h>
-#include <TROOT.h>
-
-#include <unistd.h>
-#include <signal.h>
-
-//______________________________________________________________________________
-// Full description of AliOnlineReco
-//
-
-ClassImp(AliOnlineReco)
-
-AliOnlineReco::AliOnlineReco() :
- TGMainFrame(gClient->GetRoot(), 400, 400),
-
- fRunList(0), fAutoRun(0), fStartButt(0), fStopButt(0), fExitButt(0),
- fAutoRunTimer(0), fAutoRunScheduled(0), fAutoRunRunning(0),
- fRun2PidMap(),
- fTestMode(kFALSE),
- fDoExit(kFALSE)
-{
- // Constructor.
-
- // GUI components.
- fRunList = new TGListBox(this);
- AddFrame(fRunList, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY));
-
- TGHorizontalFrame *hf = new TGHorizontalFrame(this, 1, 20);
-
- fAutoRun = new TGCheckButton(hf, "AutoRun");
- hf->AddFrame(fAutoRun, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY));
- fAutoRun->Connect("Clicked()", "AliOnlineReco", this, "DoAutoRun()");
-
- fStartButt = new TGTextButton(hf, "Start");
- hf->AddFrame(fStartButt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY));
- fStartButt->Connect("Clicked()", "AliOnlineReco", this, "DoStart()");
-
- fStopButt = new TGTextButton(hf, "Stop");
- hf->AddFrame(fStopButt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY));
- fStopButt->Connect("Clicked()", "AliOnlineReco", this, "DoStop()");
-
- fExitButt = new TGTextButton(hf, "Exit");
- hf->AddFrame(fExitButt, new TGLayoutHints(kLHintsNormal | kLHintsExpandX | kLHintsExpandY));
- fExitButt->Connect("Clicked()", "AliOnlineReco", this, "DoExit()");
-
- AddFrame(hf, new TGLayoutHints(kLHintsNormal | kLHintsExpandX));
-
- MapSubwindows();
- Layout();
- SetWindowName("Alice Online Reconstruction");
-
- // DIM interface.
- for (Int_t i = 0; i < 5; ++i)
- {
- if (i == 0)
- {
- fSOR[i] = new AliDimIntNotifier("/LOGBOOK/SUBSCRIBE/DAQ_SOR_PHYSICS");
- fEOR[i] = new AliDimIntNotifier("/LOGBOOK/SUBSCRIBE/DAQ_EOR_PHYSICS");
- }
- else
- {
- fSOR[i] = new AliDimIntNotifier(Form("/LOGBOOK/SUBSCRIBE/DAQ_SOR_PHYSICS_%d", i));
- fEOR[i] = new AliDimIntNotifier(Form("/LOGBOOK/SUBSCRIBE/DAQ_EOR_PHYSICS_%d", i));
- }
-
- fSOR[i]->Connect("DimMessage(Int_t)", "AliOnlineReco", this, "StartOfRun(Int_t)");
- fEOR[i]->Connect("DimMessage(Int_t)", "AliOnlineReco", this, "EndOfRun(Int_t)");
- }
-
- const Int_t autoRunDelay = 10; // should go to config
- fAutoRunTimer = new TTimer(autoRunDelay * 1000l);
- fAutoRunTimer->Connect("Timeout()", "AliOnlineReco", this, "AutoRunTimerTimeout()");
-
- // OS Signal handlers
- // ROOT's TSignalHAndler works not SIGCHLD ...
- AliChildProcTerminator::Instance()->Connect("ChildProcTerm(Int_t,Int_t)", "AliOnlineReco", this, "ChildProcTerm(Int_t,Int_t)");
-
- // we need this by OnExit() to kill next process child after another
- Connect("ChildProcTerm(Int_t,Int_t)", "AliOnlineReco", this, "ExitLoopChildProcTerm()");
-}
-
-AliOnlineReco::~AliOnlineReco()
-{
- // Destructor.
-
- delete fAutoRunTimer;
-}
-
-Int_t AliOnlineReco::GetLastRun() const
-{
- // Returns the last started run.
-
- return fRun2PidMap.empty() ? 0 : fRun2PidMap.rbegin()->first;
-}
-
-Bool_t AliOnlineReco::GetAutoRunMode() const
-{
- // Return state of auto-run flag.
-
- return fAutoRun->IsOn();
-}
-
-void AliOnlineReco::SetAutoRunMode(Bool_t ar)
-{
- // Set auto-run flag.
-
- if (ar == fAutoRun->IsOn())
- return;
-
- fAutoRun->SetState(ar ? kButtonDown : kButtonUp, kTRUE);
-}
-
-//------------------------------------------------------------------------------
-// Private methods
-//------------------------------------------------------------------------------
-
-AliOnlineReco::mIntInt_i AliOnlineReco::FindMapEntryByPid(Int_t pid)
-{
- // Find run-to-pid map iterator by pid.
- // Requires iteration over map.
-
- for (mIntInt_i i = fRun2PidMap.begin(); i != fRun2PidMap.end(); ++i)
- {
- if (i->second == pid)
- return i;
- }
-
- return fRun2PidMap.end();
-}
-
-void AliOnlineReco::StartAliEve(mIntInt_i& mi)
-{
- // Start alieve to process run given my the run-pid entry.
-
- Int_t run = mi->first;
-
- if (mi->second == 0)
- {
- pid_t pid = fork();
- if (pid == -1)
- {
- perror("DoStart -- Fork failed");
- return;
- }
-
- if (pid)
- {
- mi->second = pid;
- fRunList->RemoveEntry(run);
- fRunList->AddEntrySort(TString::Format("%-20d -- RUNNING", run), run);
- fRunList->Layout();
- }
- else
- {
- gCINTMutex = 0;
-
- struct sigaction sac;
- memset(&sac, 0, sizeof(sac));
- sac.sa_handler = NULL;
- sigemptyset(&sac.sa_mask);
- sac.sa_flags = 0;
-
- // The sa_restorer field is Not POSIX and obsolete.
- // This is for compilation on other systems
- #if defined(__linux) && \
- (defined(__i386__) || defined(__x86_64__)) && \
- defined(__GNUC__)
- sac.sa_restorer= NULL;
- #endif
- sigaction(SIGCHLD, &sac, NULL);
-
- int s;
- if (fTestMode)
- {
- s = execlp("alitestproc", "alitestproc", TString::Format("%d", run).Data(), (char*) 0);
- }
- else
- {
- Int_t procPID = gSystem->GetPid();
- TString logFile = Form("%s/reco/log/run%d_%d.log",
- gSystem->Getenv("ONLINERECO_BASE_DIR"),
- run,
- (Int_t)procPID);
- Info("DoStart","Reconstruction log will be written to %s",logFile.Data());
- gSystem->RedirectOutput(logFile.Data());
-
- gSystem->cd(Form("%s/reco",gSystem->Getenv("ONLINERECO_BASE_DIR")));
-
- TString gdcs;
- if (RetrieveGRP(run,gdcs) <= 0 || gdcs.IsNull())
- gSystem->Exit(1);
-
- gSystem->Setenv("DATE_RUN_NUMBER", Form("%d", run));
- // Setting CDB
- // AliCDBManager * man = AliCDBManager::Instance();
- // man->SetDefaultStorage("local:///local/cdb");
- // man->SetSpecificStorage("GRP/GRP/Data",
- // Form("local://%s",gSystem->pwd()));
- // man->SetSpecificStorage("GRP/CTP/Config",
- // Form("local://%s",gSystem->pwd()));
- // man->SetSpecificStorage("ACORDE/Align/Data",
- // "local://$ALICE_ROOT/OCDB");
-
- gSystem->mkdir(Form("run%d_%d", run, (Int_t)procPID));
- gSystem->cd(Form("run%d_%d", run, (Int_t)procPID));
-
- TString recMacroPath(gSystem->Getenv("ONLINERECO_MACRO"));
- if (recMacroPath.IsNull()) {
- recMacroPath = "$ALICE_ROOT/MONITOR/rec.C";
- }
-
- s = execlp("alieve",
- "alieve",
- "-q",
- Form("%s(\"mem://@*:\")", gSystem->ExpandPathName(recMacroPath.Data())),
- (char*) 0);
-
- }
-
- if (s == -1)
- {
- perror("execlp failed - this will not end well");
- gSystem->Exit(1);
- }
- }
- }
- else
- {
- Error("DoStart", "Process already running.");
- }
-}
-
-void AliOnlineReco::KillPid(Int_t pid)
-{
- // Terminate process given by pid.
-
- // Send terminate signal to process ...
-
- if (fTestMode)
- {
- kill(pid, SIGTERM);
- }
- else
- {
- // alieve will auto-destruct on SIGUSR1
- kill(pid, SIGUSR1);
- }
-}
-
-void AliOnlineReco::StartAutoRunTimer(Int_t run)
-{
- // Start timer for given run.
- // If an auto-started run is already active, this call is ignored.
- // If timer is already active, it is restarted.
-
- if (fAutoRunRunning)
- return;
-
- fAutoRunTimer->Reset();
- fAutoRunTimer->TurnOn();
- fAutoRunScheduled = run;
-
- Info("StartAutoRunTimer", "Scheduling run %d for auto-display.", run);
-}
-
-void AliOnlineReco::StopAutoRunTimer()
-{
- // Stop auto-run timer.
-
- fAutoRunTimer->TurnOff();
- fAutoRunScheduled = 0;
-}
-
-void AliOnlineReco::AutoRunTimerTimeout()
-{
- // Slot called on auto-timer timeout.
-
- Int_t run = fAutoRunScheduled;
-
- StopAutoRunTimer();
-
- mIntInt_i i = fRun2PidMap.find(run);
-
- if (i == fRun2PidMap.end())
- {
- Warning("AutoRunTimerTimeout", "run no longer active.");
- return;
- }
-
- Info("AutoRunTimerTimeout", "Starting display for run %d.", run);
-
- StartAliEve(i);
- fAutoRunRunning = run;
-}
-
-//------------------------------------------------------------------------------
-// Handlers of DIM signals.
-//------------------------------------------------------------------------------
-
-void AliOnlineReco::StartOfRun(Int_t run)
-{
- // Slot called from DIM handler on start of run.
-
- mIntInt_i i = fRun2PidMap.find(run);
- if (i == fRun2PidMap.end())
- {
- fRun2PidMap[run] = 0;
- fRunList->AddEntrySort(TString::Format("%d", run), run);
- fRunList->Layout();
-
- if (fAutoRun->IsOn())
- {
- StartAutoRunTimer(run);
- }
- }
- else
- {
- Error("StartOfRun", "Run %d already registered.", run);
- }
-}
-
-void AliOnlineReco::EndOfRun(Int_t run)
-{
- // Slot called from DIM handler on stop of run.
-
- mIntInt_i i = fRun2PidMap.find(run);
- if (i != fRun2PidMap.end())
- {
- Int_t pid = i->second;
- fRunList->RemoveEntry(run);
- fRunList->Layout();
- fRun2PidMap.erase(i);
- if (pid)
- {
- KillPid(pid);
- }
- gClient->NeedRedraw(fRunList);
-
- if (fAutoRunRunning == run)
- {
- fAutoRunRunning = 0;
- }
- }
- else
- {
- Error("EndOfRun", "Run %d not registered.", run);
- }
-}
-
-//------------------------------------------------------------------------------
-// Handlers of OS signals.
-//------------------------------------------------------------------------------
-
-void AliOnlineReco::ChildProcTerm(Int_t pid, Int_t status)
-{
- // Slot called on termination of child process.
-
- printf("child process termination pid=%d, status=%d...\n", pid, status);
-
- mIntInt_i i = FindMapEntryByPid(pid);
- if (i != fRun2PidMap.end())
- {
- Int_t run = i->first;
- fRunList->RemoveEntry(run);
-
- // clean (remove) run's reconstructed directory
- gSystem->Exec(Form("rm -rf %s/reco/run%d_%d",gSystem->Getenv("ONLINERECO_BASE_DIR"),run,pid));
-
- if (status == 0)
- {
- fRunList->AddEntrySort(TString::Format("%-20d -- PROCESSED", run), run);
- }
- else
- {
- fRunList->AddEntrySort(TString::Format("%-20d -- PROCESSED [%d]", run, status), run);
- }
- fRunList->Layout();
- fRun2PidMap.erase(i);
-
- if (fAutoRunRunning == run && fAutoRun->IsOn())
- {
- fAutoRunRunning = 0;
- StartAutoRunTimer(run);
- }
- else
- {
- fAutoRunRunning = 0;
- }
- }
- else
- {
- Warning("ChildProcTerm", "Process with pid=%d not registered.", pid);
- }
-
- Emit("ChildProcTerm(Int_t, Int_t)");
-}
-
-void AliOnlineReco::ExitLoopChildProcTerm()
-{
- if(fDoExit)
- DoExit();
-}
-
-//------------------------------------------------------------------------------
-// Handlers of button signals.
-//------------------------------------------------------------------------------
-
-void AliOnlineReco::DoAutoRun()
-{
- // Slot called from auto-run check-box.
-
- Bool_t autoRun = fAutoRun->IsOn();
-
- if (autoRun)
- fStartButt->SetEnabled(kFALSE);
- else
- fStartButt->SetEnabled(kTRUE);
-}
-
-void AliOnlineReco::DoStart()
-{
- // Slot called from Start button.
-
- Int_t run = fRunList->GetSelected();
- mIntInt_i i = fRun2PidMap.find(run);
-
- if (i == fRun2PidMap.end())
- {
- Error("DoStart", "no selection");
- return;
- }
-
- StartAliEve(i);
-}
-
-void AliOnlineReco::DoStop()
-{
- // Slot called from Stop button.
-
- Int_t run = fRunList->GetSelected();
- mIntInt_i i = fRun2PidMap.find(run);
-
- if (i == fRun2PidMap.end())
- {
- Error("DoStop", "no selection");
- return;
- }
-
- Int_t pid = i->second;
- if (pid)
- {
- KillPid(pid);
- }
- else
- {
- Error("DoStop", "Process not running.");
- }
-}
-
-void AliOnlineReco::DoExit()
-{
- // Slot called from Exit button or CloseWindow.
-
- // kill all started processes
- Int_t pid;
-
- // disable all widgets & AutoRunTimer
- // so that user does not initiate other GUI signals
- if(!fDoExit){
- fAutoRun->SetEnabled(kFALSE);
- fStartButt->SetEnabled(kFALSE);
- fStopButt->SetEnabled(kFALSE);
- fExitButt->SetEnabled(kFALSE);
-
- StopAutoRunTimer();
- fDoExit = kTRUE;
- gROOT->SetInterrupt(kTRUE);
- }
-
- gSystem->ProcessEvents();
-
- // clear runs std::map
- for(mIntInt_i i = fRun2PidMap.begin(); i != fRun2PidMap.end(); i++)
- {
- pid = i->second;
-
- if(pid==0)
- {
- fRun2PidMap.erase(i); // if process is not started just remove it from map
- }
- else
- {
- // send kill signal to started process
- KillPid(pid);
-
- // we need to exit loop to let ROOT process events list
- // after kill signal above, process pid starts signal AliChildProcTerminator::ChildProcTerm(int, int)
- // and arrives in AliOnlineReco::ChildProcTerm(int, int)
- // after this we return in DoExit() to process next run
- break;
- }
-
- }
-
- // we can exit after we killed all processes
- if(fRun2PidMap.empty() ) gSystem->ExitLoop();
-}
-
-void AliOnlineReco::CloseWindow()
-{
- // Virtual method called when window-manager close-window button is pressed.
-
- DoExit();
-
-}
-
-Int_t AliOnlineReco::RetrieveGRP(UInt_t run, TString &gdc)
-{
- // Retrieve GRP entry for given run from aldaqdb.
-
- TString dbHost = gSystem->Getenv("ONLINERECO_DB_HOST");
- if (dbHost.IsNull())
- {
- dbHost = "aldaqdb";
- }
-
- TString dbPort = gSystem->Getenv("ONLINERECO_DB_PORT");
- if (dbPort.IsNull())
- {
- dbPort = "0";
- }
-
- TString dbName = gSystem->Getenv("ONLINERECO_DB_NAME");
- if (dbName.IsNull())
- {
- dbName = "LOGBOOK";
- }
-
- TString user = gSystem->Getenv("ONLINERECO_DB_USER");
- if (user.IsNull())
- {
- user = "logbook";
- }
-
- TString password = gSystem->Getenv("ONLINERECO_DB_PASSWORD");
- if (password.IsNull())
- {
- password = "alice";
- }
-
- Int_t ret=AliGRPPreprocessor::ReceivePromptRecoParameters(run, dbHost.Data(),
- dbPort.Atoi(), dbName.Data(),
- user.Data(), password.Data(),
- Form("local://%s",gSystem->pwd()),
- gdc);
-
- if(ret>0) Info("RetrieveGRP","Last run of the same type is: %d",ret);
- else if(ret==0) Warning("RetrieveGRP","No previous run of the same type found");
- else if(ret<0) Error("Retrieve","Error code while retrieving GRP parameters returned: %d",ret);
- return(ret);
-}
-// @(#)root/eve:$Id$
-// Author: Matevz Tadel 2007
-
-/**************************************************************************
- * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
- * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
- * full copyright notice. *
- **************************************************************************/
-
-#ifndef ALIONLINERECO_H
-#define ALIONLINERECO_H
-
-#include "TObject.h"
-#include "TString.h"
-#include <TGFrame.h>
-
-#include <map>
-
-class AliDimIntNotifier;
-
-class TTimer;
-
-class TGTextButton;
-class TGCheckButton;
-class TGListBox;
-
-
-//______________________________________________________________________________
-// Short description of AliOnlineReco
-//
-
-
-class AliOnlineReco : public TGMainFrame
-{
-public:
- AliOnlineReco();
- virtual ~AliOnlineReco();
-
- AliDimIntNotifier* GetSOR(Int_t i) const { return fSOR[i]; }
- AliDimIntNotifier* GetEOR(Int_t i) const { return fEOR[i]; }
-
- Int_t GetLastRun() const;
-
- Bool_t GetAutoRunMode() const;
- void SetAutoRunMode(Bool_t ar);
-
- void SetTestMode() { fTestMode = kTRUE; }
-
- //------------------------------------------------------------------------------
- // Handlers of DIM signals.
- //------------------------------------------------------------------------------
-
- void StartOfRun(Int_t run);
- void EndOfRun(Int_t run);
-
- //------------------------------------------------------------------------------
- // Handlers of OS signals.
- //------------------------------------------------------------------------------
-
- void ChildProcTerm(Int_t pid, Int_t status); // *SIGNAL*
- void ExitLoopChildProcTerm();
-
- //------------------------------------------------------------------------------
- // Handlers of button signals.
- //------------------------------------------------------------------------------
-
- void DoAutoRun();
- void DoStart();
- void DoStop();
- void DoExit();
-
- virtual void CloseWindow();
-
- Int_t RetrieveGRP(UInt_t run, TString &gdc);
-
- // Things that should be private but have to be public for CINT.
- void AutoRunTimerTimeout();
-
-private:
- AliOnlineReco(const AliOnlineReco&); // Not implemented
- AliOnlineReco& operator=(const AliOnlineReco&); // Not implemented
-
- // GUI components.
- TGListBox *fRunList; // List-box for listing current runs.
- TGCheckButton *fAutoRun; // Check-box toggling auto-run when a new run starts.
- TGTextButton *fStartButt; // Start for selected run.
- TGTextButton *fStopButt; // Stop for selected run.
- TGTextButton *fExitButt; // Exit button.
-
- // DIM interface. Could do without members and just leak them ...
- AliDimIntNotifier *fSOR[5]; // DIM listeners for SOR.
- AliDimIntNotifier *fEOR[5]; // DIM listeners for EOR.
-
- // AutoRun state and timer
- TTimer *fAutoRunTimer; // Timer for auto-run on new run.
- Int_t fAutoRunScheduled; // Run for which auto-run is scheduled.
- Int_t fAutoRunRunning; // Run for which auto-run was executed.
-
- // Run-state, process mngmnt
- typedef std::map<Int_t, Int_t> mIntInt_t; // value should be struct { pid, state, ... };
- typedef mIntInt_t::iterator mIntInt_i;
-
- mIntInt_t fRun2PidMap; // Map from run-number to process id.
-
- Bool_t fTestMode; // Flag for test mode (run alitestproc instead of alieve).
- Bool_t fDoExit; // Flag for exit mode
-
- mIntInt_i FindMapEntryByPid(Int_t pid);
-
- void StartAliEve(mIntInt_i& mi);
- void KillPid(Int_t pid);
-
- void StartAutoRunTimer(Int_t run);
- void StopAutoRunTimer();
-
- ClassDef(AliOnlineReco, 0);
-};
-
-#endif
//sets the expert mode
Bool_t oldmode = fExpertMode;
fExpertMode = mode;
- TList* itemList = GetItemList();
-
- if (fExpertMode!=oldmode && itemList) fPCurrItem = (AliQADirListItem*)itemList->First();
+ if (fExpertMode!=oldmode) fPCurrItem = (AliQADirListItem*)GetItemList()->First();
}
TList* AliQAHistNavigator::GetItemList()
{
//returns the current list of histograms, if none, returns empty list
- TList* itemlist=0;
+ TList* itemlist=NULL;
if (fExpertMode)
{
- AliQADirList* expertlist = 0;
- if(fPCurrLevel) expertlist = (AliQADirList*)fPCurrLevel->GetDirs()->FindObject(fExpertDirName);
+ AliQADirList* expertlist = (AliQADirList*)fPCurrLevel->GetDirs()->FindObject(fExpertDirName);
if (expertlist) itemlist = expertlist->GetItems();
else
{
}
} else
{
- if(fPCurrLevel) itemlist = fPCurrLevel->GetItems();
+ itemlist = fPCurrLevel->GetItems();
}
return itemlist;
}
TString AliQAHistNavigator::GetDirName()
{
//get the name of dir containing current item
- if (!fPCurrItem || !fPCurrItem->GetParent()) return "";
+ if (!fPCurrItem) return "";
AliQADirList* d=(AliQADirList*)fPCurrItem->GetParent();
TString path;
do
{
// Clean up main frame...
Cleanup();
- // if(fEcan) delete fEcan; fEcan = 0;
- if(fQANavigator) delete fQANavigator; fQANavigator = 0;
+ //delete fEcan;
+ delete fQANavigator;
}
//_________________________________________________________________________
--- /dev/null
+// Author: Mihai Niculescu 2013
+
+/**************************************************************************
+ * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+#include <TEnv.h>
+#include <TSystem.h>
+#include <TThread.h>
+
+#include <AliLog.h>
+#include <AliESDEvent.h>
+#include <AliCDBManager.h>
+#include <AliGRPPreprocessor.h>
+#include <AliReconstruction.h>
+#include <AliTPCRecoParam.h>
+
+#include "AliEventServerUtil.h"
+#include "AliRecoServer.h"
+#include "AliRecoServerThread.h"
+
+ClassImp(AliRecoServer)
+AliRecoServer::AliRecoServer()
+ : TQObject(),
+ fContext(0),
+ fReco(0),
+ fCDBman(0),
+ fCurrentRunId(0),
+ fIsListenning(kFALSE),
+ fSettings(0),
+ fRecoTh(0)
+{
+ fContext = new zmq::context_t(1);
+}
+
+AliRecoServer::~AliRecoServer()
+{
+ Close(); // Full Close Server
+ delete fSettings;
+}
+
+void AliRecoServer::Close()
+{
+ if(fIsListenning){
+ Info("AliRecoServer::Close", "Closing Server");
+
+ StopReconstruction();
+
+ delete fContext; fContext=0;
+ fIsListenning = kFALSE;
+ }
+
+}
+
+const char* AliRecoServer::GetError() const
+{}
+
+Bool_t AliRecoServer::IsListenning() const
+{
+ return fIsListenning;
+}
+
+void AliRecoServer::ThreadFinished(Int_t status)
+{
+ Emit("ThreadFinished(Int_t) ", status);
+}
+
+Bool_t AliRecoServer::StartReconstruction(Int_t run, const char* input)
+{
+ fCurrentRunId = run;
+
+ // stop current reconstruction
+ StopReconstruction();
+
+ // re-read settings
+ if(fSettings) delete fSettings;
+ fSettings = new TEnv(Form("%s/MONITOR/%s", gSystem->Getenv("ALICE_ROOT"), ALIEVENTSERVER_CONF) );
+
+ TString recoBaseDir = fSettings->GetValue("server.saveRecoDir", DEFAULT_SERVER_SAVE_RECO_DIR);
+
+ // Create directories and logfile
+ TString logFile = Form("%s/log/run%d.log",
+ recoBaseDir.Data(),
+ run);
+ Info("DoStart","Reconstruction log will be written to %s",logFile.Data());
+ if( gSystem->RedirectOutput(logFile.Data())!=0){
+ printf(Form("AliRecoServer::StartReconstruction [] Error while trying to redirect output to [%s]. Exiting...", logFile.Data()) );
+ return kFALSE;
+ }
+
+ gSystem->cd(recoBaseDir.Data());
+
+ TString gdcs;
+ if (RetrieveGRP(run,gdcs) <= 0 || gdcs.IsNull())
+ return kFALSE;
+
+ gSystem->mkdir(Form("run%d", run));
+ gSystem->cd(Form("run%d", run));
+
+ // Create Reco and Reco Thread
+ SetupReco(input);
+ fReco->InitRun(input);
+
+ fRecoTh = new AliRecoServerThread(fContext, fReco);
+ fRecoTh->Start( Form("%s:%d", fSettings->GetValue("server.host", DEFAULT_SERVER_HOST), fSettings->GetValue("server.port", DEFAULT_SERVER_PORT)) );
+ fIsListenning = kTRUE;
+}
+
+void AliRecoServer::StopReconstruction()
+{
+ if(!fRecoTh) return;
+
+ fRecoTh->Stop();
+
+ delete fReco; fReco = 0;
+ delete fCDBman; fCDBman = 0;
+
+ // Emit signal
+ ThreadFinished(0);
+}
+
+Int_t AliRecoServer::RetrieveGRP(UInt_t run, TString &gdc)
+{
+ if(!fSettings) return (-1);
+
+ // Retrieve GRP entry for given run from aldaqdb.
+ TString dbHost = fSettings->GetValue("logbook.host", DEFAULT_LOGBOOK_HOST);
+ Int_t dbPort = fSettings->GetValue("logbook.port", DEFAULT_LOGBOOK_PORT);
+ TString dbName = fSettings->GetValue("logbook.db", DEFAULT_LOGBOOK_DB);
+ TString user = fSettings->GetValue("logbook.user", DEFAULT_LOGBOOK_USER);
+ TString password = fSettings->GetValue("logbook.pass", DEFAULT_LOGBOOK_PASS);
+
+ Int_t ret=AliGRPPreprocessor::ReceivePromptRecoParameters(run, dbHost.Data(),
+ dbPort, dbName.Data(),
+ user.Data(), password.Data(),
+ Form("local://%s",gSystem->pwd()),
+ gdc);
+
+ if(ret>0) Info("RetrieveGRP","Last run of the same type is: %d",ret);
+ else if(ret==0) Warning("RetrieveGRP","No previous run of the same type found");
+ else if(ret<0) Error("Retrieve","Error code while retrieving GRP parameters returned: %d",ret);
+ return(ret);
+}
+
+void AliRecoServer::SetupReco(const char* input)
+{
+ if(!fSettings) return;
+
+ //AliTPCRecoParam::SetUseTimeCalibration(kFALSE); //-- !probably should be set from conf file!
+
+ printf(Form("=========================[local://%s/..]===========\n",gSystem->pwd()));
+
+ /* Settings CDB */
+ fCDBman = AliCDBManager::Instance();
+
+ fCDBman->SetDefaultStorage(fSettings->GetValue("cdb.defaultStorage", DEFAULT_CDB_STORAGE));
+ fCDBman->SetSpecificStorage(fSettings->GetValue( "cdb.specificStoragePath1", DEFAULT_CDB_SPEC_STORAGE_PATH1),
+ fSettings->GetValue( "cdb.specificStorageValue1", DEFAULT_CDB_SPEC_STORAGE_VALUE1));
+
+ fCDBman->SetSpecificStorage(fSettings->GetValue( "cdb.specificStoragePath2", DEFAULT_CDB_SPEC_STORAGE_PATH2),
+ fSettings->GetValue( "cdb.specificStorageValue2", DEFAULT_CDB_SPEC_STORAGE_VALUE2));
+
+ fCDBman->SetSpecificStorage(fSettings->GetValue( "cdb.specificStoragePath3", DEFAULT_CDB_SPEC_STORAGE_PATH3),
+ fSettings->GetValue( "cdb.specificStorageValue3", DEFAULT_CDB_SPEC_STORAGE_VALUE3));
+
+ /* Reconstruction settings */
+ if(fReco) delete fReco;
+
+ AliReconstruction* rec = new AliReconstruction;
+
+ // QA options
+ rec->SetRunQA(fSettings->GetValue( "qa.runDetectors", DEFAULT_QA_RUN));
+ rec->SetRunGlobalQA(fSettings->GetValue( "qa.runGlobal", DEFAULT_QA_RUN_GLOBAL));
+ rec->SetQARefDefaultStorage(fSettings->GetValue( "qa.defaultStorage",DEFAULT_QAREF_STORAGE)) ;
+ rec->SetRunPlaneEff(fSettings->GetValue( "reco.runPlaneEff", DEFAULT_RECO_RUN_PLANE_EFF));
+
+ // AliReconstruction settings
+ rec->SetWriteESDfriend(fSettings->GetValue( "reco.writeESDfriend", DEFAULT_RECO_WRITE_ESDF));
+ rec->SetWriteAlignmentData(fSettings->GetValue( "reco.writeAlignment",DEFAULT_RECO_WRITE_ALIGN));
+ rec->SetInput(input); // reconstruct data from this input
+ rec->SetRunReconstruction(fSettings->GetValue( "reco.detectors", DEFAULT_RECO_DETECTORS));
+ rec->SetUseTrackingErrorsForAlignment("ITS"); //-- !should be set from conf file!
+
+ // switch off cleanESD
+ rec->SetCleanESD(fSettings->GetValue( "reco.cleanESD",DEFAULT_RECO_CLEAN_ESD));
+
+ fReco = rec;
+}
--- /dev/null
+// Author: Mihai Niculescu 2013
+
+/**************************************************************************
+ * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+#ifndef __AliRecoServer_H__
+#define __AliRecoServer_H__
+
+#include <zmq.hpp>
+#include <TObjString.h>
+#include <TQObject.h>
+#include <RQ_OBJECT.h>
+
+class TEnv;
+class AliCDBManager;
+class AliReconstruction;
+class AliRecoServerThread;
+
+class AliRecoServer : public TQObject
+{
+ RQ_OBJECT("AliRecoServer")
+public:
+ AliRecoServer();
+ virtual ~AliRecoServer();
+
+ // Closes the server. The server will no longer listen/serve
+ void Close();
+
+ Bool_t IsListenning() const;
+
+ Int_t GetRunId() const { return fCurrentRunId; }
+ const char* GetError() const;//TODO: not implemented
+
+ Bool_t StartReconstruction(Int_t run, const char* input="mem://@*:");
+ void StopReconstruction();
+
+ void ThreadFinished(Int_t status); // *SIGNAL*
+
+private:
+ Int_t RetrieveGRP(UInt_t run, TString &gdc);
+ void SetupReco(const char* input);
+
+ AliRecoServer(const AliRecoServer&); // Not implemented
+ AliRecoServer& operator=(const AliRecoServer&); // Not implemented
+
+private:
+ // thread shared
+ zmq::context_t* fContext;
+ AliReconstruction* fReco;
+ AliCDBManager* fCDBman;
+
+ // not shared
+ Int_t fCurrentRunId;
+ Bool_t fIsListenning;
+ TEnv* fSettings;
+ AliRecoServerThread* fRecoTh;
+
+public:
+
+ ClassDef(AliRecoServer, 0);
+};
+
+#endif /* __AliRecoServer_H__ */
--- /dev/null
+// Author: Mihai Niculescu 2013
+
+/**************************************************************************
+ * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+#include <stdlib.h>
+
+#include <zmq.hpp>
+
+#include <TCondition.h>
+#include <TBufferFile.h>
+#include <TMessage.h>
+#include <TObjArray.h>
+#include <TStreamerInfo.h>
+#include <TThread.h>
+
+
+#include <AliESDEvent.h>
+#include <AliESDfriend.h>
+#include <AliRawReader.h>
+#include <AliRunLoader.h>
+#include <AliReconstruction.h>
+
+#include "AliRecoServerThread.h"
+
+ClassImp(AliRecoServerThread);
+AliRecoServerThread::AliRecoServerThread(zmq::context_t *context, AliReconstruction* reco)
+ : TQObject(),
+ fContext(0),
+ fReco(0),
+ fHost("tcp://*:5051"),
+ fThread(0),
+ fCond(0)
+{
+ fContext = context;
+ fReco = reco;
+}
+
+AliRecoServerThread::~AliRecoServerThread()
+{
+ Stop();
+}
+
+Bool_t AliRecoServerThread::Start(const char* host)
+{
+ if(!fThread){
+ fHost = host;
+ fCond = new TCondition(0);
+ fThread = new TThread("AliRecoServerThread", (void(*) (void *) ) &RunThreaded, (void*) this );
+ fThread->Run();
+
+ return kTRUE;
+ }
+
+ return kFALSE;
+}
+
+Int_t AliRecoServerThread::Stop()
+{
+ fCond->Signal();
+
+ return 0;
+}
+
+Bool_t AliRecoServerThread::ForceStop()
+{
+ if(fThread){
+ fThread->Kill();
+ fThread->Delete();
+ fThread=0;
+
+ return kTRUE;
+ }
+
+ return kFALSE;
+}
+
+void AliRecoServerThread::Finished(Int_t status)
+{
+ Emit("Finished(Int_t)", status);
+}
+
+void AliRecoServerThread::SendStreamerInfos(TMessage* mess, zmq::socket_t *sock)
+{
+ //printf("Sending Streamer Infos....\n");
+
+ // Check if TStreamerInfo must be sent. The list of TStreamerInfo of classes
+ // in the object in the message is in the fInfos list of the message.
+ // We send only the TStreamerInfos not yet sent on this socket.
+ TList* infos = mess->GetStreamerInfos();
+
+ TIter next(infos);
+ TStreamerInfo *info;
+ TList *minilist = 0;
+ while ((info = (TStreamerInfo*)next())) {
+ Int_t uid = info->GetNumber();
+ if (!minilist) minilist = new TList();
+
+ minilist->Add(info);
+ }
+
+ if (minilist) {
+ TMessage messinfo(kMESS_STREAMERINFO);
+ messinfo.WriteObject(minilist);
+ delete minilist;
+ if (messinfo.GetStreamerInfos())
+ messinfo.GetStreamerInfos()->Clear();
+
+ messinfo.SetLength();
+
+ int bufsize = messinfo.Length();
+ char* buf = (char*) malloc(bufsize * sizeof(char));
+ memcpy(buf, messinfo.Buffer(), bufsize);
+
+ // send!
+ zmq::message_t message((void*)buf, bufsize, 0, 0);
+
+ if (sock->send(message, ZMQ_SNDMORE))
+ Warning("SendStreamerInfos", "problems sending TStreamerInfo's ...");
+ }
+
+ return;
+}
+
+void AliRecoServerThread::SendEvent(AliESDEvent* event, zmq::socket_t* socket)
+{
+ if(!event) return;
+
+ TMessage tmess(kMESS_OBJECT);
+ tmess.Reset();
+ tmess.WriteObject(event);
+
+ TMessage::EnableSchemaEvolutionForAll(kTRUE);
+ SendStreamerInfos(&tmess, socket);
+
+ tmess.SetLength();
+
+ int bufsize = tmess.Length();
+ char* buf = (char*) malloc(bufsize * sizeof(char));
+ memcpy(buf, tmess.Buffer(), bufsize);
+
+ // send!
+ zmq::message_t message((void*)buf, bufsize, 0, 0);
+ socket->send(message);
+
+}
+
+
+void* AliRecoServerThread::RunThreaded(void* arg)
+{
+ TThread::SetCancelAsynchronous();
+ TThread::SetCancelOn();
+
+ AliRecoServerThread* recoTh = (AliRecoServerThread*)arg;
+
+ const char* host = recoTh->GetHost();
+ zmq::context_t* context = recoTh->GetContext();
+ AliReconstruction* reco = recoTh->GetReconstruction();
+
+ zmq::socket_t publisher(*context, ZMQ_PUB);
+ publisher.bind(host);
+
+ if(reco==0) return 0;
+
+ AliESDEvent* event;
+
+ reco->Begin(NULL);
+ if (reco->GetAbort() != TSelector::kContinue) return 0;
+
+ reco->SlaveBegin(NULL);
+ if (reco->GetAbort() != TSelector::kContinue) return 0;
+
+ //******* The loop over events
+ Int_t iEvent = 0;
+ while ( reco->HasNextEventAfter(iEvent) ) {
+ // check if process has enough resources
+ if (!reco->HasEnoughResources(iEvent)) break;
+ Bool_t status = reco->ProcessEvent(iEvent);
+
+ if (status)
+ {
+ event = reco->GetESDEvent();
+ SendEvent(event, &publisher);
+
+ sleep(1);
+ }
+ else {
+ reco->Abort("ProcessEvent",TSelector::kAbortFile);
+ }
+
+ reco->CleanProcessedEvent();
+ if(recoTh->Condition()->TimedWaitRelative(500)==0){
+ break;
+ }
+ iEvent++;
+ }
+ reco->SlaveTerminate();
+ if (reco->GetAbort() != TSelector::kContinue) return 0;
+ reco->Terminate();
+ if (reco->GetAbort() != TSelector::kContinue) return 0;
+
+}
--- /dev/null
+// Author: Mihai Niculescu 2013
+
+/**************************************************************************
+ * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+#ifndef __AliRecoServerThread_H__
+#define __AliRecoServerThread_H__
+
+#include <TQObject.h>
+#include <RQ_OBJECT.h>
+#include <TMutex.h>
+#include <TCondition.h>
+
+class TCondition;
+class TMessage;
+class TThread;
+
+class AliReconstruction;
+class AliESDEvent;
+
+namespace zmq{
+ class context_t;
+ class socket_t;
+}
+
+class AliRecoServerThread : public TQObject
+{
+public:
+ AliRecoServerThread(zmq::context_t *context, AliReconstruction* reco);
+ virtual ~AliRecoServerThread();
+
+ Bool_t Start(const char* host);
+ Int_t Stop();
+ Bool_t ForceStop(); // imediate kill it, use it with rarely and with caution
+
+ zmq::context_t* GetContext() { return fContext; }
+ AliReconstruction* GetReconstruction() { return fReco; }
+ const char* GetHost() { return fHost.Data(); }
+ TCondition* Condition() { return fCond; }
+
+ void Finished(Int_t status); // *SIGNAL*
+
+private:
+ static void* RunThreaded(void* arg);
+ static void SendStreamerInfos(TMessage* mess, zmq::socket_t *sock);
+ static void SendEvent(AliESDEvent* event, zmq::socket_t* socket);
+
+ // shared
+ zmq::context_t* fContext;
+ AliReconstruction* fReco;
+
+ // local
+ TString fHost;
+ TThread* fThread;
+ TCondition* fCond; // condition whether to stop reco/clean exit thread
+
+private:
+ AliRecoServerThread(const AliRecoServerThread&); // Not implemented
+ AliRecoServerThread& operator=(const AliRecoServerThread&); // Not implemented
+
+public:
+
+ ClassDef(AliRecoServerThread, 0);
+};
+#endif /* __AliReconstructionThread_H__ */
+
cmake_minimum_required(VERSION 2.8.4 FATAL_ERROR)
+# This will only build MONITOR only if ZeroMQ is found
+if(ZEROMQ_FOUND)
file(GLOB PACKAGES CMake*.pkg)
-
ALICE_BuildModule()
+ENDIF(ZEROMQ_FOUND)
--- /dev/null
+#--------------------------------------------------------------------------------#
+# Package File for alionlinemonitor #
+# Author : Johny Jose (johny.jose@cern.ch) #
+# Variables Defined : #
+# #
+# SRCS - C++ source files #
+# HDRS - C++ header files #
+# DHDR - ROOT Dictionary Linkdef header file #
+# CSRCS - C source files #
+# CHDRS - C header files #
+# EINCLUDE - Include directories #
+# EDEFINE - Compiler definitions #
+# ELIBS - Extra libraries to link #
+# ELIBSDIR - Extra library directories #
+# PACKFFLAGS - Fortran compiler flags for package #
+# PACKCXXFLAGS - C++ compiler flags for package #
+# PACKCFLAGS - C compiler flags for package #
+# PACKSOFLAGS - Shared library linking flags #
+# PACKLDFLAGS - Module linker flags #
+# PACKBLIBS - Libraries to link (Executables only) #
+# EXPORT - Header files to be exported #
+# CINTHDRS - Dictionary header files #
+# CINTAUTOLINK - Set automatic dictionary generation #
+# ARLIBS - Archive Libraries and objects for linking (Executables only) #
+# SHLIBS - Shared Libraries and objects for linking (Executables only) #
+#--------------------------------------------------------------------------------#
+
+set ( SRCS alieventserver.cxx)
+
+set ( EINCLUDE ${EINCLUDE} TPC ITS RAW)
+
+set ( PACKBLIBS ${ROOTCLIBS} ${SYSLIBS})
+
+set ( ELIBSDIR )
+
+set(MFT_UPGRADE $ENV{MFT_UPGRADE})
+
+if(MFT_UPGRADE)
+set ( ELIBS MUONevaluation MUONmapping MUONshuttle MUONgraphics MUONsim MUONrec MUONgeometry MUONcalib MUONbase MUONraw MUONtrigger MUONcore TPCbase TPCsim TPCrec ITSbase ITSsim ITSrec PMDbase PMDsim PMDrec TRDbase TRDsim TRDrec FMDbase FMDsim FMDrec TOFbase TOFrec TOFsim PHOSUtils PHOSbase PHOSsim PHOSrec ACORDEbase ACORDEsim ACORDErec HMPIDbase HMPIDrec HMPIDsim ZDCbase ZDCsim ZDCrec VZERObase VZEROsim VZEROrec MFTbase MFTsim MFTrec EMCALUtils EMCALbase EMCALsim EMCALrec EMCALraw BCM STRUCT T0base T0sim T0rec FASTSIM microcern HLTbase TRIGGERbase STEER STAT CDB AOD STEERBase ESD ANALYSIS RAWDatasim RAWDatarec RAWDatabase)
+else(MFT_UPGRADE)
+set ( ELIBS MUONevaluation MUONmapping MUONshuttle MUONgraphics MUONsim MUONrec MUONgeometry MUONcalib MUONbase MUONraw MUONtrigger MUONcore TPCbase TPCsim TPCrec ITSbase ITSsim ITSrec PMDbase PMDsim PMDrec TRDbase TRDsim TRDrec FMDbase FMDsim FMDrec TOFbase TOFrec TOFsim PHOSUtils PHOSbase PHOSsim PHOSrec ACORDEbase ACORDEsim ACORDErec HMPIDbase HMPIDrec HMPIDsim ZDCbase ZDCsim ZDCrec VZERObase VZEROsim VZEROrec EMCALUtils EMCALbase EMCALsim EMCALrec EMCALraw BCM STRUCT T0base T0sim T0rec FASTSIM microcern HLTbase TRIGGERbase STEER STAT CDB AOD STEERBase ESD ANALYSIS RAWDatasim RAWDatarec RAWDatabase)
+endif(MFT_UPGRADE)
+
+if(PYTHIA6)
+ list(APPEND ELIBS EVGEN)
+endif(PYTHIA6)
+
+if( ALICE_TARGET STREQUAL "macosx")
+
+ string(REGEX REPLACE "(microcern|lhapdf|herwig)" "" ELIBS "${ELIBS}")
+
+ ALICE_Format(PACKLDFLAGS "-Wl,-u,_G__cpp_setupG__" "" "${LDFLAGS};${ELIBSCPP}")
+ string ( REPLACE "%" "-Wl,-u,_G__cpp_setupG__%" PACKLDFLAGS "${LDFLAGS} ${ELIBSCPP}" )
+
+ set ( ELIBSDIR ${ELIBSDIR} ${FINK_ROOT}/lib)
+
+endif( ALICE_TARGET STREQUAL "macosx")
+
+if(MFT_UPGRADE)
+ set (ARPACKS FMDbase FMDsim FMDrec ACORDEbase ACORDEsim ACORDErec HMPIDbase HMPIDsim HMPIDrec ZDCbase ZDCsim ZDCrec VZERObase VZEROsim VZEROrec MFTbase MFTsim MFTrec EMCALUtils EMCALbase EMCALsim EMCALrec T0base T0sim T0rec TOFbase TOFsim TOFrec TRDbase TRDsim TRDrec PMDbase PMDsim PMDrec MUONmapping MUONmapping MUONgeometry MUONbase MUONsim MUONrec MUONraw PHOSUtils PHOSbase PHOSsim PHOSrec HLTbase ITSbase ITSsim ITSrec STRUCT TPCbase TPCsim TPCrec TPCfast STEER CDB ESD STEERBase RAWDatabase RAWDatasim RAWDatarec MDC TRIGGERbase)
+else(MFT_UPGRADE)
+ set (ARPACKS FMDbase FMDsim FMDrec ACORDEbase ACORDEsim ACORDErec HMPIDbase HMPIDsim HMPIDrec ZDCbase ZDCsim ZDCrec VZERObase VZEROsim VZEROrec EMCALUtils EMCALbase EMCALsim EMCALrec T0base T0sim T0rec TOFbase TOFsim TOFrec TRDbase TRDsim TRDrec PMDbase PMDsim PMDrec MUONmapping MUONmapping MUONgeometry MUONbase MUONsim MUONrec MUONraw PHOSUtils PHOSbase PHOSsim PHOSrec HLTbase ITSbase ITSsim ITSrec STRUCT TPCbase TPCsim TPCrec TPCfast STEER CDB ESD STEERBase RAWDatabase RAWDatasim RAWDatarec MDC TRIGGERbase)
+endif(MFT_UPGRADE)
+
+set(GFILES)
+foreach (pkg ${ARPACKS})
+# foreach(mod ${MODDIRS})
+# string(REGEX MATCH "${mod}" DIR ${pkg})
+# if(DIR)
+# list(APPEND GFILES "${CMAKE_BINARY_DIR}/${DIR}/CMakeFiles/${pkg}_a.dir/G__${pkg}.cxx.o" )
+# set_source_files_properties("G${pkg}" PROPERTIES GENERATED TRUE )
+# set_source_files_properties("G__${pkg}.cxx" PROPERTIES GENERATED TRUE)
+ list(APPEND AFILES "${pkg}_a")
+
+# endif(DIR)
+# endforeach(mod)
+endforeach(pkg)
+set (ARLIBS ${AFILES})
+list(APPEND SRCS ${GFILES})
+set ( SHLIBS ${BINLIBDIRS} EVGEN -lEGPythia6 Pythia6 -lpythia6 AliPythia6 lhapdf THijing hijing THerwig herwig TPHIC FASTSIM microcern)
+
+set ( EINCLUDE STEER/STEER )
+set ( ELIBS ${ELIBS} MONITOR )
+
+
+set ( DATE_ROOT $ENV{DATE_ROOT})
+
+if (DATE_ROOT)
+ set ( PACKBLIBS ${PACKBLIBS} ${DMONLIBS})
+ set ( ELIBSDIR )
+ set ( EINCLUDE ${EINCLUDE} ${DATE_COMMON_DEFS} ${DATE_MONITOR_DIR})
+endif (DATE_ROOT)
+
+set (DIMDIR $ENV{DIMDIR})
+set (ODIR $ENV{ODIR})
+
+if (DIMDIR)
+ set ( EINCLUDE ${EINCLUDE} ${DIMDIR}/dim)
+ set ( ELIBS ${ELIBS} dim)
+ set ( ELIBSDIR ${ELIBSDIR} ${DIMDIR}/${ODIR})
+endif (DIMDIR)
+
+if( ALICE_TARGET MATCHES "macosx")
+
+ ALICE_Format (TEMP "-Wl,-u,_G__cpp_setupG__" "" ${ELIBS})
+ set(PACKLDFLAGS "${LDFLAGS} ${TEMP}")
+
+endif( ALICE_TARGET MATCHES "macosx")
-#--------------------------------------------------------------------------------#
-# Package File for alionlinemonitor #
-# Author : Johny Jose (johny.jose@cern.ch) #
-# Variables Defined : #
-# #
-# SRCS - C++ source files #
-# HDRS - C++ header files #
-# DHDR - ROOT Dictionary Linkdef header file #
-# CSRCS - C source files #
-# CHDRS - C header files #
-# EINCLUDE - Include directories #
-# EDEFINE - Compiler definitions #
-# ELIBS - Extra libraries to link #
-# ELIBSDIR - Extra library directories #
-# PACKFFLAGS - Fortran compiler flags for package #
-# PACKCXXFLAGS - C++ compiler flags for package #
-# PACKCFLAGS - C compiler flags for package #
-# PACKSOFLAGS - Shared library linking flags #
-# PACKLDFLAGS - Module linker flags #
-# PACKBLIBS - Libraries to link (Executables only) #
-# EXPORT - Header files to be exported #
-# CINTHDRS - Dictionary header files #
-# CINTAUTOLINK - Set automatic dictionary generation #
-# ARLIBS - Archive Libraries and objects for linking (Executables only) #
-# SHLIBS - Shared Libraries and objects for linking (Executables only) #
-#--------------------------------------------------------------------------------#
-
-set ( SRCS alionlinemonitor.cxx)
-
-set ( EINCLUDE ${EINCLUDE} TPC ITS RAW)
-
-set ( PACKBLIBS ${ROOTCLIBS} ${SYSLIBS})
-
-set ( ELIBS MONITOR TPCbase TPCsim TPCrec HLTbase ITSbase ITSsim ITSrec MUONmapping MUONevaluation MUONsim MUONrec MUONgeometry MUONcalib MUONbase MUONraw RAWDatasim MUONtrigger MUONcore STEER CDB AOD RAWDatarec ESD RAWDatabase STEERBase ANALYSIS)
-
-set ( DATE_ROOT $ENV{DATE_ROOT})
-
-if (DATE_ROOT)
-
- set ( PACKBLIBS ${PACKBLIBS} ${DMONLIBS})
- set ( ELIBSDIR )
- set ( EINCLUDE ${EINCLUDE} ${DATE_COMMON_DEFS} ${DATE_MONITOR_DIR})
-
-endif (DATE_ROOT)
-
-set (DIMDIR $ENV{DIMDIR})
-set(ODIR $ENV{ODIR})
-
-if (DIMDIR)
-
- set ( EINCLUDE ${EINCLUDE} ${DIMDIR}/dim)
- set ( ELIBS ${ELIBS} dim)
- set ( ELIBSDIR ${ELIBSDIR} ${DIMDIR}/${ODIR})
-
-endif (DIMDIR)
-
-if( ALICE_TARGET MATCHES "macosx")
-
- ALICE_Format (TEMP "-Wl,-u,_G__cpp_setupG__" "" ${ELIBS})
- set(PACKLDFLAGS "${LDFLAGS} ${TEMP}")
-
-endif( ALICE_TARGET MATCHES "macosx")
AliQAHistViewer.cxx
AliOnlineRecoTrigger.cxx
AliDimIntNotifier.cxx
- AliChildProcTerminator.cxx
- AliOnlineReco.cxx
+ AliChildProcTerminator.cxx
+ AliEventServerPreferencesWindow.cxx
+ AliEventServerWindow.cxx
+ AliRecoServerThread.cxx
+ AliRecoServer.cxx
AliTestChildProc.cxx
)
set ( DHDR MONITORLinkDef.h)
-set ( EINCLUDE TPC ITS RAW STEER/STEER STEER/CDB STEER/STEERBase)
+set ( EINCLUDE TPC TPC/Rec ITS RAW STEER/STEER STEER/CDB STEER/STEERBase ZEROMQ_INCLUDE_DIR)
set(DIMDIR $ENV{DIMDIR})
set(ODIR $ENV{ODIR})
if(DIMDIR)
-
set ( SRCS ${SRCS} SORNotifier.cxx)
set ( EINCLUDE ${EINCLUDE} ${DIMDIR}/dim)
set ( ELIBS dim)
set ( ELIBSDIR ${DIMDIR}/${ODIR})
- if(ELIBSDIR STREQUAL "${DIMDIR}/")
+ if(ELIBSDIR STREQUAL "${DIMDIR}/")
set (ELIBSDIR ${DIMDIR}/linux)
endif(ELIBSDIR STREQUAL "${DIMDIR}/")
- set ( PACKCXXFLAGS "${CXXFLAGS} -DALI_DIM")
- set ( PACKDCXXFLAGS "${CXXFLAGSNO} -DALI_DIM")
+ set ( CXXFLAGS "-DALI_DIM ${CXXFLAGS}")
endif(DIMDIR)
+
+set ( ELIBS ${ELIBS} ${ZEROMQ_LIBRARY} )
+
+# this must be set in a better way
+set ( ELIBSDIR ${ELIBSDIR} /usr/lib64)
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
-
+
+#pragma link C++ class AliEventServerPreferencesWindow+;
+#pragma link C++ class AliEventServerWindow+;
+#pragma link C++ class AliRecoServerThread+;
+#pragma link C++ class AliRecoServer+;
#pragma link C++ class AliQAHistNavigator+;
#pragma link C++ class AliQAHistViewer+;
#pragma link C++ class AliQADirList+;
#pragma link C++ class AliDimIntNotifier+;
#pragma link C++ class AliChildProcTerminator+;
-#pragma link C++ class AliOnlineReco+;
#pragma link C++ class AliTestChildProc+;
#endif
--- /dev/null
+// Author: Mihai Niculescu 2013
+
+/**************************************************************************
+ * Copyright(c) 1998-2013, ALICE Experiment at CERN, all rights reserved. *
+ * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
+ * full copyright notice. *
+ **************************************************************************/
+
+#include <TApplication.h>
+#include "AliEventServerWindow.h"
+
+int main(int argc, char **argv)
+{
+ TApplication app("AliEventServer", &argc, argv);
+
+ AliEventServerWindow *win = new AliEventServerWindow;
+ app.Run(kTRUE);
+
+ if(win) delete win;
+ win=0;
+
+ return 0;
+}
--- /dev/null
+server.host: tcp://*
+server.port: 5024
+server.saveRecoDir: /home/user/reco
+cdb.defaultStorage: local:///local/cdb
+cdb.specificStoragePath1: GRP/GRP/Data
+cdb.specificStorageValue1:
+cdb.specificStoragePath2: GRP/CTP/Config
+cdb.specificStorageValue2:
+cdb.specificStoragePath3:
+cdb.specificStorageValue3:
+qa.runDetectors: :
+qa.defaultStorage: local://$ALICE_ROOT/QAref
+qa.runGlobal: 1
+reco.runPlaneEff: 1
+reco.writeESDfriend: 1
+reco.writeAlignment: 1
+reco.cleanESD: 0
+reco.detectors: ALL -PHOS -EMCAL -HLT
+logbook.host: pcaldbl501
+logbook.port: 3306
+logbook.db: logbook
+logbook.user: dqm
+logbook.pass: nopass
-#include "AliDimIntNotifier.h"
-#include "AliOnlineReco.h"
-
-#include <TRint.h>
-
-#include <TSQLServer.h>
-#include <TSQLResult.h>
-#include <TSQLRow.h>
-
-#include <TTimeStamp.h>
-
-int main(int argc, char **argv)
-{
- AliDimIntNotifier::SetMainThreadId();
-
- Bool_t test = argc > 1 && strcmp("-test", argv[1]) == 0;
-
- TRint app("App", &argc, argv);
-
- AliOnlineReco *win = new AliOnlineReco;
- win->MapWindow();
-
- TString autoRun(gSystem->Getenv("ONLINERECO_AUTORUN"));
- if (autoRun == "1" || autoRun.CompareTo("true", TString::kIgnoreCase) == 0)
- {
- win->SetAutoRunMode(kTRUE);
- }
-
- if (test)
- {
- win->SetTestMode();
-
- win->GetSOR(0)->infoHandlerTest(2214);
- win->GetSOR(0)->infoHandlerTest(2215);
- win->GetSOR(0)->infoHandlerTest(2224);
- win->GetSOR(0)->infoHandlerTest(2244);
-
- printf("win = (AliOnlineReco*) 0x%lx\n", (unsigned long)win);
- }
- else
- {
- TString baseDir = gSystem->Getenv("ONLINERECO_BASE_DIR");
- if (baseDir.IsNull())
- {
- printf("ERROR: ONLINERECO_BASE_DIR is not set. Exiting...");
- return 0;
- }
-
- TString dbHost = gSystem->Getenv("ONLINERECO_DB_HOST");
- if (dbHost.IsNull())
- {
- printf("ERROR: ONLINERECO_DB_HOST is not set. Exiting...");
- return 0;
- }
-
- TString dbPort = gSystem->Getenv("ONLINERECO_DB_PORT");
- if (dbPort.IsNull())
- {
- printf("ERROR: ONLINERECO_DB_PORT is not set. Exiting...");
- return 0;
- }
-
- TString dbName = gSystem->Getenv("ONLINERECO_DB_NAME");
- if (dbName.IsNull())
- {
- printf("ERROR: ONLINERECO_DB_NAME is not set. Exiting...");
- return 0;
- }
-
- TString user = gSystem->Getenv("ONLINERECO_DB_USER");
- if (user.IsNull())
- {
- printf("ERROR: ONLINERECO_DB_USER is not set. Exiting...");
- return 0;
- }
-
- TString password = gSystem->Getenv("ONLINERECO_DB_PASSWORD");
- if (password.IsNull())
- {
- printf("ERROR: ONLINERECO_DB_PASSWORD is not set. Exiting...");
- return 0;
- }
-
- TSQLServer* server = TSQLServer::Connect(Form("mysql://%s:%s/%s", dbHost.Data(), dbPort.Data(), dbName.Data()), user.Data(), password.Data());
- if (!server) {
- printf("ERROR: Could not connect to DAQ Logbook");
- return 0;
- }
- TString sqlQuery;
- TTimeStamp ts;
- sqlQuery.Form("SELECT run FROM logbook WHERE DAQ_time_start > %u AND DAQ_time_end IS NULL AND partition REGEXP 'PHYSICS.*'",
- (UInt_t)ts.GetSec()-86400);
- TSQLResult* result = server->Query(sqlQuery);
- if (!result)
- {
- printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
- return 0;
- }
- if (result->GetRowCount() == 0)
- {
- printf("No active physics runs found");
- }
- else
- {
- for (Int_t iRow = 0; iRow < result->GetRowCount(); iRow++)
- {
- TSQLRow* row = result->Next();
- TString runStr = row->GetField(0);
- if (runStr.IsDigit())
- win->StartOfRun(runStr.Atoi());
- delete row;
- }
- }
- delete result;
- }
-
- app.Run(kTRUE);
-
- return 0;
-}
Int_t fNCells; // Number of cells
Short_t *fCellNumber; //[fNCells] array of cell numbers
- Double32_t *fAmplitude; //[fNCells][0.,0.,16] array with cell amplitudes (= energy!)
- Double32_t *fTime; //[fNCells][0.,0.,16] array with cell times
- Double32_t *fEFraction; //[fNCells][0.,0.,16] array with fraction of MC energy and data - for embedding
+ Double32_t *fAmplitude; //[fNCells] array with cell amplitudes (= energy!)
+ Double32_t *fTime; //[fNCells] array with cell times
+ Double32_t *fEFraction; //[fNCells] array with fraction of MC energy and data - for embedding
Int_t *fMCLabel; //[fNCells] array of MC labels
Bool_t fIsSorted; //! true if cell arrays are sorted by index
Char_t fType; // Cell type
Abort("ProcessEvent",TSelector::kAbortFile);
return kFALSE;
}
+ CleanProcessedEvent();
iEvent++;
}
if (!iEvent) AliWarning("No events passed trigger selection");
nbf,fMemCountESDHLT,fhlttree->GetTotBytes(),fhlttree->GetZipBytes()));
}
+
+ return kTRUE;
+}
- // call AliEVE
- if (fRunAliEVE) RunAliEVE();
+void AliReconstruction::CleanProcessedEvent()
+{
//
fesd->Reset();
fhltesd->Reset();
if (fReconstructor[iDet]) fReconstructor[iDet]->FinishEvent();
}
- gSystem->GetProcInfo(&procInfo);
- Long_t dMres=(procInfo.fMemResident-oldMres)/1024;
- Long_t dMvir=(procInfo.fMemVirtual-oldMvir)/1024;
- Float_t dCPU=procInfo.fCpuUser+procInfo.fCpuSys-oldCPU;
- aveDMres+=(dMres-aveDMres)/(iEvent-fFirstEvent+1);
- aveDMvir+=(dMvir-aveDMvir)/(iEvent-fFirstEvent+1);
- aveDCPU+=(dCPU-aveDCPU)/(iEvent-fFirstEvent+1);
- AliInfo(Form("======================= End Event %d: Res %ld(%3ld <%3ld>) Vir %ld(%3ld <%3ld>) CPU %5.2f <%5.2f> ===================",
- iEvent, procInfo.fMemResident/1024, dMres, aveDMres, procInfo.fMemVirtual/1024, dMvir, aveDMvir, dCPU, aveDCPU));
- oldMres=procInfo.fMemResident;
- oldMvir=procInfo.fMemVirtual;
- oldCPU=procInfo.fCpuUser+procInfo.fCpuSys;
-
+ AliInfo("======================= End Event ===================");
+
fEventInfo.Reset();
for (Int_t iDet = 0; iDet < kNDetectors; iDet++) {
if (fReconstructor[iDet]) {
DeleteRecPoints(fDeleteRecPoints);
DeleteDigits(fDeleteDigits);
//
- return kTRUE;
+
}
//_____________________________________________________________________________
}
return res;
}
+
+Bool_t AliReconstruction::HasNextEventAfter(Int_t eventId)
+{
+ return ( (eventId < fRunLoader->GetNumberOfEvents()) ||
+ (fRawReader && fRawReader->NextEvent()) );
+}
Float_t GetV0CsPmin() const {return fV0CsPmin;}
Float_t GetDmax() const {return fDmax;}
Float_t GetZmax() const {return fZmax;}
+
+ Bool_t HasNextEventAfter(Int_t eventId);
+
//
Bool_t IsRunMultFinder() const {return fRunMultFinder;}
kNDetectors = 16 // number of detectors // AU
};
static Int_t GetDetIndex(const char * detector);
+ static const char** GetDetectorNames() { return fgkDetectorName; }
// Upgrade
void SetUpgradeModule(const char* detectors) {fUpgradeModule = detectors; MatchUpgradeDetector() ; }
void DeclareTriggerClasses(const char *trClasses) {fDeclTriggerClasses = trClasses;}
//
//
+ void CleanProcessedEvent();
+
+ AliESDEvent* GetESDEvent() const { return fesd; }
+ AliESDfriend* GetESDfriend() const { return fesdf; }
+ AliRunLoader* GetRunLoader() const { return fRunLoader;}
+ AliRawReader* GetRawReader() const { return fRawReader; }
+
Bool_t HasEnoughResources(int ev);
void SetStopOnResourcesExcess(int vRSS=3000,int vVMEM=4000);
//
{
public:
- AliVCaloTrigger() {;}
+ AliVCaloTrigger(): TNamed() {;}
AliVCaloTrigger(const char* name, const char* title) : TNamed(name, title) {;}
AliVCaloTrigger(const AliVCaloTrigger& ctrig);
virtual ~AliVCaloTrigger() {;}
class AliVVertex: public TNamed {
public:
- AliVVertex() { }
+ AliVVertex() : TNamed() { }
virtual ~AliVVertex() { }
AliVVertex(const AliVVertex& vVert);
AliVVertex& operator=(const AliVVertex& vVert);
--- /dev/null
+# Copyright (c) 2010-2011 Phorm, Inc.
+# License: GNU LGPL v 3.0, see http://www.gnu.org/licenses/lgpl-3.0-standalone.html
+# Author: Andrey Skryabin <andrew@zmqmessage.org>, et al.
+
+# - Find 0mq
+# Find the zeromq includes and library
+#
+# ZEROMQ_INCLUDE_DIR - Where to find zeromq include sub-directory.
+# ZEROMQ_LIBRARIES - List of libraries when using zeromq.
+# ZEROMQ_FOUND - True if zeromq found.
+
+IF (ZEROMQ_INCLUDE_DIR)
+ # Already in cache, be silent.
+ SET(ZEROMQ_FIND_QUIETLY TRUE)
+ENDIF (ZEROMQ_INCLUDE_DIR)
+
+FIND_PATH(ZEROMQ_INCLUDE_DIR zmq.hpp)
+
+SET(ZEROMQ_NAMES zmq)
+FIND_LIBRARY(ZEROMQ_LIBRARY NAMES ${ZEROMQ_NAMES} )
+
+# Handle the QUIETLY and REQUIRED arguments and set ZEROMQ_FOUND to
+# TRUE if all listed variables are TRUE.
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(
+ ZEROMQ DEFAULT_MSG
+ ZEROMQ_LIBRARY ZEROMQ_INCLUDE_DIR
+)
+
+IF(ZEROMQ_FOUND)
+ SET( ZEROMQ_LIBRARIES ${ZEROMQ_LIBRARY} )
+ELSE(ZEROMQ_FOUND)
+ SET( ZEROMQ_LIBRARIES )
+ENDIF(ZEROMQ_FOUND)
+
+