Skip to content
Snippets Groups Projects
Commit ca717bc2 authored by tzhang74's avatar tzhang74
Browse files

elog src imported

parent 84a2adbe
No related branches found
No related tags found
No related merge requests found
......@@ -8,12 +8,12 @@ INCLUDEDIRS = -I$(XXUSBDIR)/include -I./include
LIBDIRS = -L$(XXUSBDIR)/lib
LIBS = -lxx_usb -lm -lusb
CXXFLAGS = -g -O2 -Wall `root-config --cflags`
CXXFLAGS = -g -O2 -Wall `root-config --cflags`
LDFLAGS = -O2 `root-config --glibs` -Wl,-rpath=$(XXUSBDIR)/lib
SOURCES = MyDaq.cpp MyMainFrame.cpp GenericModule.cpp Phillips2249W.cpp SharedData.cpp CC-DAQ.cpp
INCLUDES = MyDaq.h MyMainFrame.h GenericModule.h Phillips2249W.h SharedData.h Module.h Common.h LinkDef.h
SOURCES = MyDaq.cpp MyMainFrame.cpp GenericModule.cpp Phillips2249W.cpp SharedData.cpp CC-DAQ.cpp eloghandler.cc
INCLUDES = MyDaq.h MyMainFrame.h GenericModule.h Phillips2249W.h SharedData.h Module.h Common.h LinkDef.h eloghandler.h
OBJ = runMyDaq
SOURCEDIR = src/
......@@ -24,17 +24,17 @@ CINCLUDES = $(addprefix $(INCLUDEDIR),$(INCLUDES))
RUNDIR = run/
all: $(CSOURCES) $(CINCLUDES) $(SOURCEDIR)MyMainFrameDict.cpp
all: $(CSOURCES) $(CINCLUDES) $(SOURCEDIR)MyMainFrameDict.cpp
$(CXX) $(CXXFLAGS) $(INCLUDEDIRS) $(CSOURCES) $(SOURCEDIR)MyMainFrameDict.cpp \
$(LIBDIRS) $(LIBS) $(LDFLAGS) -o $(OBJ)
[ -d $(RUNDIR) ] || mkdir $(RUNDIR)
$(LIBDIRS) $(LIBS) $(LDFLAGS) -o $(OBJ)
[ -d $(RUNDIR) ] || mkdir $(RUNDIR)
mv $(OBJ) $(RUNDIR)
[ -f $(RUNDIR)env.sh ] || echo "export XXUSBDIR="$(XXUSBDIR) >> $(RUNDIR)env.sh
@echo "Done"
$(SOURCEDIR)MyMainFrameDict.cpp: $(SOURCEDIR)MyMainFrame.cpp $(INCLUDEDIR)MyMainFrame.h
rootcling -f $(SOURCEDIR)MyMainFrameDict.cpp -c $(INCLUDEDIRS) MyMainFrame.h $(INCLUDEDIR)LinkDef.h
[ -d $(RUNDIR) ] || mkdir $(RUNDIR)
[ -d $(RUNDIR) ] || mkdir $(RUNDIR)
cp $(SOURCEDIR)MyMainFrameDict* $(RUNDIR)
clean:
......
#ifndef __ELOGHANDLER_H
#define __ELOGHANDLER_H
#include <string>
class ElogHandler {
public:
//** Constructors
ElogHandler (const std::string h, const int p, const std::string name);
virtual ~ElogHandler() {};
virtual int BegrunLog ( const int run, std::string who, std::string filename);
virtual int EndrunLog ( const int run, std::string who, const int events, const double volume=0, time_t starttime=0);
virtual std::string getHost() const {return hostname;};
virtual int getPort() const {return port;};
virtual std::string getLogbookName() const {return logbookname;};
protected:
std::string hostname;
std::string logbookname;
int port;
};
#endif
#include <eloghandler.h>
#include <iostream>
#include <stdlib.h>
#include <sstream>
using namespace std;
ElogHandler::ElogHandler (const std::string h, const int p, const std::string name)
{
hostname=h;
port=p;
logbookname = name;
}
int ElogHandler::BegrunLog ( const int run, std::string who, std::string filename)
{
ostringstream command;
command << "elog -h " << hostname << " -p " << port << " -l " << logbookname <<
" -a \"Author=" << who << "\"" <<
" -a \"Subject=Run " << run << " started\" " <<
"\"Run " << run << " started with file " << filename << "\"" <<
" >/dev/null 2<&1" << endl;
// cout << command.str() << endl;
system (command.str().c_str() );
return 0;
}
int ElogHandler::EndrunLog ( const int run, std::string who, const int events, const double volume, time_t starttime)
{
ostringstream command;
command << "elog -h " << hostname << " -p " << port
<< " -l " << logbookname<< " -a \"Author=" << who << "\""
<< " -a \"Subject=Run " << run << " ended\" "
<< "\"Run " << run
<< " ended with " << events
<< " events, size is " << volume << " MB"
<< " duration " << time(0) - starttime << " s\" "
<< " >/dev/null 2<&1" << endl;
// cout << command.str() << endl;
system (command.str().c_str() );
return 0;
}
README FOR MUON LAB USING CC-USB CRATE CONTROLLER
WRITTEN BY YAKOV KULINICH SPRING 2016
MODIFIED BY TIANSU ZHANG 2019
------------------------------------------------------
------------------------------------------------------
Simple Installation Instructions
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment