From: Samir Amar-Youcef Date: Mon, 23 Mar 2015 09:09:29 +0000 (+0100) Subject: add makefile X-Git-Url: https://jspc29.x-matter.uni-frankfurt.de/git/?a=commitdiff_plain;h=1f9287117f973c4d30b908af9641c418c18c7cda;p=mvd_soft.git add makefile --- diff --git a/s-curves/cpp_sam/Makefile b/s-curves/cpp_sam/Makefile new file mode 100644 index 0000000..a31dd25 --- /dev/null +++ b/s-curves/cpp_sam/Makefile @@ -0,0 +1,16 @@ +CC=g++ +CFLAGS=-c -g -Wall -std=c++11 `root-config --cflags` +LDFLAGS=`root-config --glibs` +CLDFLAGS = -std=c++11 `root-config --cflags --glibs` -lboost_system -lboost_filesystem +SOURCES= main.C unpacker.C unpacker.h help.h header.h +OBJECTS=$(subst .cc,.o,$(SOURCES)) +EXECUTABLE=unpacker + +all: $(SOURCES) $(EXECUTABLE) + +$(EXECUTABLE): $(OBJECTS) + $(CC) $(CLDFLAGS) $(OBJECTS) -o $@ + + +clean: + rm -f $(OBJS) \ No newline at end of file diff --git a/s-curves/cpp_sam/main.C b/s-curves/cpp_sam/main.C new file mode 100644 index 0000000..8fba989 --- /dev/null +++ b/s-curves/cpp_sam/main.C @@ -0,0 +1,22 @@ +// #include "TApplication.h" +#include +#include +#include "unpacker.h" +#include "TROOT.h" + +//#################################################################### + + +int main(int argc, char** argv) { + + gROOT->Reset(); + + TString Dir; + TString File; + + if (argc>1) { Dir = argv[1]; } + if (argc>2) { File = argv[2]; } + + unpacker* a=new unpacker(Dir, File); + delete a; +} \ No newline at end of file diff --git a/s-curves/cpp_sam/run.C b/s-curves/cpp_sam/run.C deleted file mode 100644 index fb6782f..0000000 --- a/s-curves/cpp_sam/run.C +++ /dev/null @@ -1,16 +0,0 @@ -#include "unpacker.C" - -void run() -{ -// unpacker* a=new unpacker("/local/samir/data/normalmode/","60s_blank.hld"); - - - unpacker* a=new unpacker("/local/samir/data","te15036113837"); -// unpacker* a=new unpacker("/local/samir/data","te15021111151"); - - -// unpacker* a=new unpacker("/local/samir/data","te15021111151.hld"); -// unpacker* a=new unpacker("/local/samir/data","test"); -// unpacker* a=new unpacker("/local/samir/data","test.hld"); - delete a; -} \ No newline at end of file diff --git a/s-curves/cpp_sam/rungui.C b/s-curves/cpp_sam/rungui.C deleted file mode 100755 index 937efa5..0000000 --- a/s-curves/cpp_sam/rungui.C +++ /dev/null @@ -1,13 +0,0 @@ -#include "config.h" -#include "unpack.C" - - -//#################################################################### - -void rungui() -{ - unpacker* a=new unpacker("/local/samir/data/te15021111151.hld"); - a->scanFrames(0,10000000); - delete a; - -} \ No newline at end of file diff --git a/s-curves/cpp_sam/unpacker.C b/s-curves/cpp_sam/unpacker.C index 8979de1..3b93825 100644 --- a/s-curves/cpp_sam/unpacker.C +++ b/s-curves/cpp_sam/unpacker.C @@ -5,9 +5,10 @@ //----------------- #include "unpacker.h" +#include "header.h" #include -#include +// #include // #include // #include //----------------- @@ -17,13 +18,12 @@ unpacker::unpacker(TString Dir, TString File) { fPixelProb = new Float_t [1152*576]; - fRowCount = new UInt_t [576]; + fRowCount = new UShort_t [576]; for(int i=0;i<1152*576;i++) { fPixelProb [i]=0; } for(int i=0;i<576;i++) { fRowCount [i]=0; } // fWrongRowNumber = 0; fWrongRunNumber = 0; - fWrongThreshold = 0; fHeaderVer = 0; fRunNumber_tmp = 0; @@ -38,6 +38,16 @@ unpacker::unpacker(TString Dir, TString File) { // Init if( !openFiles(Dir, File) ) { cerr << "ERROR: No Files found!" << endl << "-- Exit --" << endl; exit(-1); } + + if( fDataTree==0 ) + { + cout<<"\r Tree started: "<Branch("threshold" , &fThreshold_tmp , "threshold/s" , 32000); + fDataTree->Branch("pixelprob" , fPixelProb , "pixelprob[663552]/F" , 32000); + fDataTree->Branch("frames" , fRowCount , "frames[576]/s" , 32000); + } scanFiles(); } @@ -78,20 +88,20 @@ void unpacker::scanFiles() { int subEventNr = 0; int subSubEventNr = 0; - UInt_t HDRver; +// UInt_t HDRver; UInt_t DATAver = 0; // UInt_t HDRsize; // Progress bar -// ULong_t progress_tmp=-1; -// Float_t progress; + ULong_t progress_tmp=-1; + Float_t progress; while( getNextEvent() !=0 ) { eventNr++; subEventNr = 0; while( getNextSubEvent() !=0 ) { subEventNr++; subSubEventNr = 0; while( getNextSubSubEvent() !=0 ) { subSubEventNr++; // Progress bar -// progress = (Int_t)(((fPosGlo)*100.)/(fLength-1)*1); -// if(progress!=progress_tmp) { print_progress( (((fPosGlo)*100.)/(fLength-1)) ); progress_tmp=progress; } + progress = (Int_t)(((fPosGlo)*100.)/(fLength-1)*1); + if(progress!=progress_tmp) { print_progress( (((fPosGlo)*100.)/(fLength-1)) ); progress_tmp=progress; } // -------------------- // fRawData : allocates the event data // fPosInData : points to the position of the subsubevent in the data, beginning with the subsubevent hld-header @@ -99,32 +109,30 @@ void unpacker::scanFiles() { // -------------------- if(fSubSubEventSize>4) { - HDRver = bigEndian8(fRawData,fPosInData+4); - DATAver = bigEndian8(fRawData,fPosInData+5); +// HDRver = bigEndian8(fRawData,fPosInData+4); +// DATAver = bigEndian8(fRawData,fPosInData+5); // HDRsize = bigEndian8(fRawData,fPosInData+7); - if ( DATAver==0x01) - { - - } - else if ( DATAver==0x02 ) - { - - } - else if ( DATAver==0xC0 ) - { - if( !fHeaderVer && fSubSubEventSize==164 ) { fHeaderVer=1; cout<<"\r 'Frame Timestamp' missing in Header! Sub-Sub-Event Length: "<>4) & 0xF; UInt_t Row = ((Int_t)(UChar_t)fRawData[fPosInData+17]& 0xF)*TMath::Power(2,8) + (Int_t)(UChar_t)fRawData[fPosInData+18]; - UInt_t RunNumber = bigEndian8 (fRawData,fPosInData+19); +// UInt_t RunNumber = bigEndian8 (fRawData,fPosInData+19); UInt_t Data; // cout<=9*Bank && dataword<9*(Bank+1) ) + { Data = bigEndian32 (fRawData,fPosInData+20+dataword); if (Data == 0) @@ -192,28 +193,24 @@ void unpacker::anaScurves() { { for(int pixel=0;pixel<32;pixel++) { - fPixelProb[1152*(fRow_count+1)+32*dataword+pixel ] ++; + fPixelProb[1152*(Row)+32*dataword+pixel ] ++; } } else { for(int pixel=0;pixel<32;pixel++) { - fPixelProb[1152*(fRow_count+1)+32*dataword+pixel ] += (Data & 0x1); + fPixelProb[1152*(Row)+32*dataword+pixel ] += (Data & 0x1); Data >>= 1; } } + } } - fRowCount[fRow_count]++; + fRowCount[Row]++; +// cout<Branch("threshold" , &fThreshold_tmp , "threshold/s" , 32000); - fDataTree->Branch("pixelprob" , fPixelProb , "pixelprob[663552]/F" , 32000); - fDataTree->Branch("frames" , fRowCount , "frames[576]/s" , 32000); - } - for(int row=0;row<576;row++) { for(int col=0;col<1152;col++) @@ -248,6 +235,10 @@ void unpacker::saveScurveData() { // cout< +//----------------- +#ifndef CONFIG_H +#define CONFIG_H + +#define SAVE 4 +#define ENDING "hld" +#define CONTENTIN 1048576 // --> 1 MByte +#define BUFSIZE 32000 +#define MAXSENSORS 64 +#define MAXSTATES 1140 +#define MAXCLUSTERS 1140 +#endif +//----------------- + +// #include +#include +#include +#include +#include +#include "help.h" class unpacker { @@ -28,15 +47,14 @@ private: UInt_t fPaddingSub; Float_t* fPixelProb; - UInt_t* fRowCount; + UShort_t* fRowCount; UInt_t fRunNumber_count; UInt_t fRunNumber_tmp; UInt_t fRow_count; UInt_t fRow_tmp; - UInt_t fThreshold_tmp; + UShort_t fThreshold_tmp; bool fWrongRowNumber; - bool fWrongThreshold; bool fWrongRunNumber; bool fFirstOut; bool fHeaderVer; @@ -51,11 +69,12 @@ private: UInt_t getNextSubEvent (); UInt_t getNextSubSubEvent (); - UInt_t littleEndian32 (char* RawData, Int_t Pos); - UInt_t bigEndian32 (char* RawData, Int_t Pos); - UInt_t bigEndian24 (char* RawData, Int_t Pos); - UInt_t bigEndian16 (char* RawData, Int_t Pos); - UInt_t bigEndian8 (char* RawData, Int_t Pos); + UInt_t littleEndian32 (char* RawData, Int_t Pos); + UInt_t bigEndian32 (char* RawData, Int_t Pos); + UInt_t bigEndian24 (char* RawData, Int_t Pos); + UInt_t bigEndian16 (char* RawData, Int_t Pos); + UInt_t bigEndian8 (char* RawData, Int_t Pos); + Int_t print_progress (Float_t ProgressInPercent); public: // Methods