From 86d315585d187011912644080ebbf6e797f2de5f Mon Sep 17 00:00:00 2001 From: Vratislav Chudoba Date: Tue, 27 Dec 2016 11:47:48 +0300 Subject: [PATCH] Class for raw data added. --- dataClasses/Data.mk | 22 +++++++++++++ dataClasses/RawData.cpp | 36 ++++++++++++++++++++++ dataClasses/RawData.h | 42 +++++++++++++++++++++++++ dataClasses/linkdef.h | 11 +++++++ dataClasses/rawData.cpp | 0 dataClasses/rawData.h | 0 macros/test.cxx | 15 +++++++++ makefile | 68 +++++++++++++++++++++++++++++++++++++++++ 8 files changed, 194 insertions(+) create mode 100755 dataClasses/Data.mk create mode 100644 dataClasses/RawData.cpp create mode 100644 dataClasses/RawData.h create mode 100755 dataClasses/linkdef.h delete mode 100644 dataClasses/rawData.cpp delete mode 100644 dataClasses/rawData.h create mode 100644 macros/test.cxx create mode 100755 makefile diff --git a/dataClasses/Data.mk b/dataClasses/Data.mk new file mode 100755 index 0000000..a5ad69c --- /dev/null +++ b/dataClasses/Data.mk @@ -0,0 +1,22 @@ +################################################################################ +# AculData input with some variables +################################################################################ + +DATALIBS := -lHist #-lCore #-lCint -lRIO -lTree -lNet -lThread -lMatrix -lMathCore -lGpad -lGraf -lSpectrum #-lTELoss + +# Add inputs and outputs from these tool invocations to the build variables +DATA_HEADERS += \ +$(DATA)/RawData.h \ +$(DATA)/linkdef.h + +DATACPP_SRCS += \ +$(DATA)/RawData.cpp \ +$(DATA)/DataCint.cpp + +DATAOBJS += \ +$(DATA)/RawData.o \ +$(DATA)/DataCint.o + +DATACPP_DEPS += \ +$(DATA)/RawData.d \ +$(DATA)/DataCint.d \ No newline at end of file diff --git a/dataClasses/RawData.cpp b/dataClasses/RawData.cpp new file mode 100644 index 0000000..0d9a50f --- /dev/null +++ b/dataClasses/RawData.cpp @@ -0,0 +1,36 @@ +/* + * RawData.cpp + * + * Created on: Dec 27, 2016 + * Author: vratik + */ + +#include "RawData.h" + +RawData::RawData() { + // TODO Auto-generated constructor stub + + TGraph gr; + +} + +RawData::~RawData() { + // TODO Auto-generated destructor stub +} + +void RawData::Reset() { + + for (Int_t i = 0; i < 1024; i++) { + Amp[i] = 0; + Time[i] = 0; + } + + +} + +void RawData::Print() { + for (Int_t i = 0; i < 1024; i++) { + cout << Amp[i] << endl; +// Time[i] = 0; + } +} diff --git a/dataClasses/RawData.h b/dataClasses/RawData.h new file mode 100644 index 0000000..52200a2 --- /dev/null +++ b/dataClasses/RawData.h @@ -0,0 +1,42 @@ +/* + * RawData.h + * + * Created on: Dec 27, 2016 + * Author: vratik + */ + +#ifndef DATACLASSES_RAWDATA_H_ +#define DATACLASSES_RAWDATA_H_ + +#include + +#include "TGraph.h" + +using std::cout; +using std::endl; + +class RawData { + +private: + Double_t Amp[1024]; + Double_t Time[1024]; + +public: + RawData(); + virtual ~RawData(); + ClassDef(RawData,1); + + void Reset(); + + const Double_t* GetAmp() const { + return Amp; + } + + const Double_t* GetTime() const { + return Time; + } + + void Print(); +}; + +#endif /* DATACLASSES_RAWDATA_H_ */ diff --git a/dataClasses/linkdef.h b/dataClasses/linkdef.h new file mode 100755 index 0000000..f83a2b1 --- /dev/null +++ b/dataClasses/linkdef.h @@ -0,0 +1,11 @@ +#ifdef __CINT__ +#pragma link off all globals; +#pragma link off all classes; +#pragma link off all functions; + +#pragma link C++ class RawData; +//#pragma link C++ class ConfigDictionary; + + +#endif + diff --git a/dataClasses/rawData.cpp b/dataClasses/rawData.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/dataClasses/rawData.h b/dataClasses/rawData.h deleted file mode 100644 index e69de29..0000000 diff --git a/macros/test.cxx b/macros/test.cxx new file mode 100644 index 0000000..b236ea4 --- /dev/null +++ b/macros/test.cxx @@ -0,0 +1,15 @@ +//void test() +{ + + gSystem->Load("../libData.so"); + + RawData o; + + Double_t *m = o.GetAmp(); + + for(Int_t i = 0; i < 1024; i++) { + m[i] = 1; + } + + o.Print(); +} diff --git a/makefile b/makefile new file mode 100755 index 0000000..a05ed76 --- /dev/null +++ b/makefile @@ -0,0 +1,68 @@ +################################################################################ +# Makefile building all dynamic libraries: +# +# +# OBJS - files type *.o (subdir.mk) +# LIBS - list of the loaded libraries (objects.mk) +# RM - command "rm -rf" +# CPP_DEPS - files type *.d (subdir.mk) +# .PHONY - +# .SECONDARY - +# +# Vratislav Chudoba +################################################################################ + +RM := rm -rf + +CC := g++ + +#global paths +ROOTINCS = $(shell root-config --incdir) +ROOTLIBS = $(shell root-config --libdir) +ROOTCFLAGS = $(shell root-config --cflags) +PWD = $(shell pwd) + +DATA = $(PWD)/dataClasses + +-include $(DATA)/Data.mk + +all: libData.so \ + + +#ROOT html documentation, it will be done as a program which will be alsa compiled by this makefile, program will be as a last condition after all of the libraries +#htmldoc: libAculData.so +# -$(RM) htmldoc +# root -l -q html.cxx + +clean: + -$(RM) $(DATAOBJS) $(DATACPP_DEPS) + -$(RM) $(DATA)/DataCint.* libData.so + -@echo ' ' + -$(RM) htmldoc + -@echo ' ' + +# Those *Cint* files below need special treating: +$(DATA)/DataCint.cpp: + -@echo 'Pre-building DataCint.cpp and DataCint.h files' + -rootcint -f $(DATA)/DataCint.cpp -c -p $(DATA_HEADERS) + -@echo ' ' + +#*.so files +libData.so: $(DATAOBJS) + @echo 'Building target: $@' + @echo 'Invoking: GCC C++ Linker' + $(CC) -L $(ROOTLIBS) -shared -o"libData.so" $(DATAOBJS) $(DATALIBS) + @echo 'Finished building target: $@' + @echo ' ' + + +.PHONY: all clean + +# Each subdirectory must supply rules for building sources it contributes +%.o: %.cpp + @echo 'Building file: $@' + @echo 'Invoking: $(CC) Compiler' + $(CC) -I$(ROOTINCS) -O0 -g3 -Wall -c -fmessage-length=0 -fPIC $(ROOTCFLAGS) -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" +# $(CC) -I$(ROOTINCS) -O2 -Wall -mmmx -msse -msse2 -msse3 -mfpmath=sse,387 -march=nocona -mtune=nocona -c -fmessage-length=0 -fPIC -MMD -MP -MF"$(@:%.o=%.d)" -MT"$(@:%.o=%.d)" -o"$@" "$<" + @echo 'Finished building: $@' + @echo ' ' -- 2.18.1