Commit fdee31a3 authored by LEGEARD Luc's avatar LEGEARD Luc
Browse files

Add PARIS frame

parent 745b6627
......@@ -75,7 +75,7 @@ DataGenParameters.cc MFMBlobFrame.cc MFMEbyedatFrame.cc MFMNedaFrame.cc
DataParameters.cc MFMBoxDiagFrame.cc MFMExogamFrame.cc MFMNumExoFrame.cc MFMS3SynchroFrame.cc MFMXmlFileHeaderFrame.cc
DataPar.cc MFMChimeraFrame.cc MFMOscilloFrame.cc MFMScalerDataFrame.cc
DataScal.cc MFMCoboFrame.cc MFMHelloFrame.cc MFMRibfFrame.cc DataScalers.cc
MFMCoboTopoFrame.cc MFMMergeFrame.cc MFMS3AlphaFrame.cc MFMVamosICFrame.cc
MFMCoboTopoFrame.cc MFMMergeFrame.cc MFMS3AlphaFrame.cc MFMVamosICFrame.cc MFMParisFrame.cc
MError.cc MFMCommonFrame.cc MFMMutantFrame.cc MFMS3BaF2Frame.cc MFMVamosPDFrame.cc MFMReaGenericFrame.cc
MFMBasicFrame.cc MFMDiamantFrame.cc MFMNedaCompFrame.cc MFMS3eGUNFrame.cc MFMVamosTACFrame.cc MFMReaTraceFrame.cc
MFMSiriusFrame.cc MFMS3DeflectorFrame.cc GanTape/acq_ebyedat_get_next_event.cxx
......@@ -87,9 +87,11 @@ DataGenParameters.h MFMAllFrames.h MFMCoboTopoFrame.h MFMMergeFrame.h
DataParameters.h MFMBasicFrame.h MFMCommonFrame.h MFMMutantFrame.h MFMRibfFrame.h MFMScalerDataFrame.h MFMXmlFileHeaderFrame.h
DataPar.h MFMBlobFrame.h MFMDiamantFrame.h MFMNedaCompFrame.h MFMS3AlphaFrame.h MFMTypes.h XmlTags.h
DataScalers.h MFMBoxDiagFrame.h MFMEbyedatFrame.h MFMNedaFrame.h MFMS3BaF2Frame.h MFMVamosICFrame.h MFMReaTraceFrame.h
DataScal.h MFMChimeraFrame.h MFMExogamFrame.h MFMS3eGUNFrame.h MFMVamosPDFrame.h MFMReaGenericFrame.h MFMSiriusFrame.h MFMS3DeflectorFrame.h CUtilities.h
ArgInterpretor.h GanTape/GEN_TYPE.H GanTape/gan_acq_buf.h GanTape/acq_ebyedat_get_next_event.h GanTape/STR_EVT.H GanTape/gan_tape_erreur.h GanTape/gan_acq_swap_buf.h
MFMFewDefines.h
DataScal.h MFMChimeraFrame.h MFMExogamFrame.h MFMS3eGUNFrame.h MFMVamosPDFrame.h MFMReaGenericFrame.h MFMSiriusFrame.h
MFMParisFrame.h MFMS3DeflectorFrame.h
CUtilities.h ArgInterpretor.h MFMFewDefines.h
GanTape/GEN_TYPE.H GanTape/gan_acq_buf.h GanTape/acq_ebyedat_get_next_event.h GanTape/STR_EVT.H GanTape/gan_tape_erreur.h GanTape/gan_acq_swap_buf.h
)
......
......@@ -34,5 +34,5 @@
#include "MFMReaTraceFrame.h"
#include "MFMSiriusFrame.h"
#include "MFMS3DeflectorFrame.h"
#include "MFMParisFrame.h"
#endif
......@@ -10,7 +10,7 @@
#include "MFMBlobFrame.h"
#define NUMEXO_FRAMESIZE 32
#define NUMEXO_HEADERFRAMESIZE 18
#define NUMEXO_HEADERFRAMESIZE 18 // 8 from Common header + MFM_numexo_eventInfo (10)
#define NUMEXO_CRYS_MASK 0x001f
#define NUMEXO_CHANNEL_ID_MASK NUMEXO_CRYS_MASK
#define NUMEXO_BOARD_ID_MASK 0x07ff
......
/*
MFMParisFrame.cc
Copyright Acquisition group, GANIL Caen, France
*/
#include <iostream>
#include <cmath>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <stdlib.h>
using namespace std;
#include "MFMParisFrame.h"
//_______________________________________________________________________________
MFMParisFrame::MFMParisFrame(int unitBlock_size, int dataSource,
int frameType, int revision, int frameSize, int headerSize) {
/// Constructor for a PARIS frame . the header is filled with unitblock_size, data source , frame type , revision , frame, size and header size value
SetPointers();
}
//_______________________________________________________________________________
MFMParisFrame::MFMParisFrame() {
/// Constructor for a empty PARIS frame
}
//_______________________________________________________________________________
MFMParisFrame::~MFMParisFrame() {
/// destructor of PARIS frame
}
//_______________________________________________________________________________
void MFMParisFrame::SetQShort(uint16_t energy) {
/// Set Energy
(((MFM_paris_frame*) pHeader)->Data.QShort) = energy;
}
//_______________________________________________________________________________
uint16_t MFMParisFrame::GetQShort()const {
/// GetEnergy
uint16_t energy;
energy=(((MFM_paris_frame*) pHeader)->Data.QShort);
if (fLocalIsBigEndian != fFrameIsBigEndian)
SwapInt16(&energy);
return energy;
}
//_______________________________________________________________________________
void MFMParisFrame::SetQLong(uint16_t energy) {
/// Set Energy
(((MFM_paris_frame*) pHeader)->Data.QLong) = energy;
}
//_______________________________________________________________________________
uint16_t MFMParisFrame::GetQLong() const{
/// GetEnergy
uint16_t energy;
energy=(((MFM_paris_frame*) pHeader)->Data.QLong);
if (fLocalIsBigEndian != fFrameIsBigEndian)
SwapInt16(&energy);
return energy;
}
//_______________________________________________________________________________
void MFMParisFrame::SetCfd(float cfd) {
/// Set Top in frame
(((MFM_paris_frame*) pHeader)->Data.Cfd) = cfd;
}
//_______________________________________________________________________________
float MFMParisFrame::GetCfd()const {
/// computer and return Top value from frame
float cfd;
cfd = ((((MFM_paris_frame*) pHeader)->Data.Cfd) + random()/RAND_MAX -0.5 )/ 1000.;
return cfd;
}
//_______________________________________________________________________________
void MFMParisFrame::FillDataWithRamdomValue(uint64_t timestamp,
uint32_t eventnumber) {
/// Fill all data of frame with random values to do test
/// And report time stamp and event number
float maxuint16 = pow(2,16);
float maxuint32 = pow(2,32);
float value = random();
uint16_t uivalue16 = (uint16_t) (maxuint16 * (float)(value / RAND_MAX));
uint32_t uivalue32 = (uint32_t) (maxuint32 * (float)(value / RAND_MAX));
SetQShort(uivalue16);
SetQLong (uivalue16);
SetCfd (uivalue32 +0.5);
SetEventNumber(eventnumber);
SetTimeStamp(timestamp);
MFMNumExoFrame::FillDataWithRamdomValue(timestamp,eventnumber);
SetFrameType (MFM_PARIS_FRAME_TYPE);
}
//_______________________________________________________________________________
string MFMParisFrame::GetHeaderDisplay(char* infotext)const{
std::stringstream ss;
std::string display("");
ss << MFMNumExoFrame::GetHeaderDisplay(infotext);
ss << std::endl;
ss << " qShort = " << GetQShort() ;
ss << " qLong = " << GetQLong() << " CFD = " << GetCfd() << " [ns]";
ss << std::endl;
ss << " Flags = " << std::hex << ((MFM_paris_frame*) pHeader)->Data.Flags << std::dec ;
ss << " PLL unlock " << ((GetPLL()) ? "true" : "false");
ss << " PUR " << ((GetPUR()) ? "true" : "false");
ss << " OVR " << ((GetOVR()) ? "true" : "false");
display = ss.str();
return display;
}
//_______________________________________________________________________________
bool MFMParisFrame::GetPLL()const {
return ((((MFM_paris_frame*) pHeader)->Data.Flags)&0x20)>>5;
}
//_______________________________________________________________________________
bool MFMParisFrame::GetPUR()const{
return ((((MFM_paris_frame*) pHeader)->Data.Flags)&0x10)>>4;
}
//_______________________________________________________________________________
bool MFMParisFrame::GetOVR()const{
return ((((MFM_paris_frame*) pHeader)->Data.Flags)&0x8)>>3;
}
#ifndef _MFMParisFrame_
#define _MFMParisFrame_
/*
MFMParisFrame.h
Copyright Acquisition Group, GANIL Caen, France
*/
#include "MFMNumExoFrame.h"
#define MFM_PARIS_FRAME_TYPE_TXT "MFM_PARIS_FRAME_TYPE"
#define PARIS_UNIT_BLOCK_SIZE 1
#define PARIS_FRAMESIZE 28
#pragma pack(push, 1) // force alignment
struct MFM_paris_data{
unsigned LocationID: 16;
unsigned QShort : 16;
unsigned QLong : 16;
unsigned Cfd : 24;
unsigned Flags : 8;
};
struct MFM_paris_frame{
MFM_common_header Header;
MFM_numexo_eventInfo EventInfo;
MFM_paris_data Data;
};
//____________MFMParisFrame___________________________________________________________
class MFMParisFrame:public MFMNumExoFrame
{
public :
MFMParisFrame();
MFMParisFrame(int unitBlock_size, int dataSource,
int frameType, int revision, int frameSize,int headerSize);
virtual ~MFMParisFrame();
// PARIS
void SetQShort(uint16_t energy);
uint16_t GetQShort() const;
void SetQLong(uint16_t energy);
uint16_t GetQLong()const ;
void SetCfd(float cfd);
float GetCfd()const;
void FillDataWithRamdomValue(uint64_t timestamp,uint32_t enventnumber);
string GetHeaderDisplay(char* infotext) const;
virtual bool GetPLL() const;
virtual bool GetPUR() const;
virtual bool GetOVR() const;
const char * GetTypeText()const {return MFM_PARIS_FRAME_TYPE_TXT;}
virtual int GetDefinedUnitBlockSize()const {return PARIS_UNIT_BLOCK_SIZE ;};
virtual int GetDefinedHeaderSize()const {return NUMEXO_HEADERFRAMESIZE;};
virtual int GetDefinedFrameSize()const {return PARIS_FRAMESIZE;};
uint16_t GetChecksum()const{ return 0;}
};
#pragma pack(pop) // free aligment
#endif
......@@ -17,7 +17,7 @@ using namespace std;
//_______________________________________________________________________________
MFMS3DeflectorFrame::MFMS3DeflectorFrame(int unitBlock_size, int dataSource,
int frameType, int revision, int frameSize, int headerSize) {
/// Constructor for a exogam frame . the header is filled with unitblock_size, data source , frame type , revision , frame, size and header size value
/// Constructor for a frame . the header is filled with unitblock_size, data source , frame type , revision , frame, size and header size value
SetPointers();
}
//_______________________________________________________________________________
......
......@@ -5,11 +5,11 @@
//value of shift, Event Number, TimeStamps , location(bord number and channel)
#define NUMEXO_EN_SHI MFM_BLOB_HEADER_SIZE
#define NUMEXO_EN_SHI MFM_BLOB_HEADER_SIZE /// SHI = Shift
#define NUMEXO_TS_SHI MFM_BLOB_HEADER_SIZE + 4
#define NUMEXO_LO_SHI MFM_BLOB_HEADER_SIZE + 4 + 6
#define NUMEXO_LO_SHI MFM_BLOB_HEADER_SIZE + 4 + 6 // LO = location
#define NUMEXO_LO_SHI2 MFM_BLOB_HEADER_SIZE
#define NUMEXO_EN_SHI_INV MFM_BLOB_HEADER_SIZE + 6
#define NUMEXO_EN_SHI_INV MFM_BLOB_HEADER_SIZE + 6 // INV = inverse
#define NUMEXO_TS_SHI_INV MFM_BLOB_HEADER_SIZE
#define NO_TS 0
......@@ -65,6 +65,7 @@
#define MFM_SIRIUS_FRAME_TYPE 0x70 /// Sirius data frame BAS_EN_SHI2 BAS_TS_SHI2 NUMEXO_LO_SHI2 0
#define MFM_REA_TRACE_FRAME_TYPE 0x71 /// Trace Rea Frame BAS_EN_SHI2 BAS_TS_SHI2 BAS_LO_SHI 0
#define MFM_S3_DEFLECTOR_FRAME_TYPE 0x80 /// Deflector frame NUMEXO_EN_SHI NUMEXO_TS_SHI NUMEXO_LO_SHI 1
#define MFM_PARIS_FRAME_TYPE 0x90 /// PARIS frame NUMEXO_EN_SHI NUMEXO_TS_SHI NUMEXO_LO_SHI 1
#define MFM_HELLO_FRAME_TYPE 0xFF00 /// Hello Frame NUMEXO_EN_SHI_INV NUMEXO_TS_SHI_INV NO_LO 0
#define MFM_MERGE_EN_FRAME_TYPE 0xFF01 /// Merge frame in envent number BAS_EN_SHI NO_TS NO_LO 0
......
......@@ -51,6 +51,7 @@ MFMReaTraceFrame * fReaTraceframe;
MFMS3SynchroFrame * fS3Synchroframe;
MFMSiriusFrame * fSiriusframe;
MFMS3DeflectorFrame * fDeflectorframe;
MFMParisFrame * fParisframe;
DataParameters * fDataPara;
DataScalers * fDataScal;
......@@ -182,13 +183,15 @@ int main(int argc, char **argv) {
fS3eGUNframe = new MFMS3eGUNFrame();
fS3Synchroframe = new MFMS3SynchroFrame();
fReaGenericframe = new MFMReaGenericFrame();
uint16_t tabcard[1]; // this is given in example
tabcard[0]=112; // this is given in example
//fReaGenericframe -> InitTabValues(tabcard,1); // this is given in example and test
fReaTraceframe = new MFMReaTraceFrame();
fSiriusframe = new MFMSiriusFrame();
fDeflectorframe = new MFMS3DeflectorFrame();
fParisframe = new MFMParisFrame();
uint16_t tabcard[1]; // this is given in example
tabcard[0]=112; // this is given in example
//fReaGenericframe -> InitTabValues(tabcard,1); // this is given in example and test
fCoboframe->InitStat();
fExoframe->InitStat();
fEbyframe->InitStat();
......@@ -219,6 +222,7 @@ int main(int argc, char **argv) {
fS3Synchroframe->InitStat();
fSiriusframe->InitStat();
fDeflectorframe->InitStat();
fParisframe->InitStat();
// treatment of input arguments
ArgInterpretor ArgInt(argc,argv);
......@@ -649,6 +653,7 @@ void deletefunction(){
if (fReaTraceframe ) delete (fReaTraceframe);
if (fSiriusframe) delete (fSiriusframe) ;
if (fDeflectorframe) delete (fDeflectorframe) ;
if (fParisframe) delete (fParisframe) ;
}
//_______________________________________________________________________________________________________________________
......@@ -681,6 +686,7 @@ void PrintQuestion() {
cout << " 25 ReaTrace Frame\n";
cout << " 26 Sirius Frame\n";
cout << " 27 S3 Deflector Frame\n";
cout << " 28 Paris Frame\n";
cout << " 97 Xml Data Description Frame\n";
cout << " 98 Xml Data Header MFM Frame file\n";
cout << " 99 Mixte of all Frame\n";
......@@ -804,6 +810,7 @@ void HelpList() {
cout <<" MFM_SIRIUS_FRAME_TYPE 0x70 = 112 /// Sirius data frame"<<endl;
cout <<" MFM_REA_TRACE_FRAME_TYPE 0x71 = 113 /// Generic Rea Frame"<<endl;
cout <<" MFM_S3_DEFLECTOR_FRAME_TYPE 0x80 = 128 /// S3 Deflector frame"<<endl;
cout <<" MFM_PARIS_FRAME_TYPE 0x90 = 144 /// Paris frame"<<endl;
cout <<""<<endl;
cout <<" MFM_HELLO_FRAME_TYPE 0xFF00 = 65280 /// Hello Frame"<<endl;
cout <<" MFM_MERGE_EN_FRAME_TYPE 0xFF01 = 65281/// Merge frame in envent number"<<endl;
......@@ -945,6 +952,10 @@ void ReadUserFrame(MFMCommonFrame* commonframe) {
fDeflectorframe->ReadAttributsExtractFrame(fVerbose,fDumpsize, display,noframe,commonframe->GetPointHeader());
break;
}
case MFM_PARIS_FRAME_TYPE: {
fParisframe->ReadAttributsExtractFrame(fVerbose,fDumpsize, display,noframe,commonframe->GetPointHeader());
break;
}
default: {
fCount_elseframe++;
commonframe->ReadAttributsExtractFrame(fVerbose,fDumpsize, display,noframe,commonframe->GetPointHeader());
......@@ -1124,7 +1135,10 @@ void WriteUserFrame(int lun, int format, int fNbFrames, int fNbSubFrames) {
fDeflectorframe->WriteRandomFrame(lun,fNbFrames, fVerbose, fDumpsize,MFM_S3_DEFLECTOR_FRAME_TYPE);
break;
}
case 28: {
fParisframe->WriteRandomFrame(lun,fNbFrames, fVerbose, fDumpsize,MFM_PARIS_FRAME_TYPE);
break;
}
//_____________________ XmlDataDescriptionFrame frame______________________________________________________
case 97: {
fDatadescriptionframe->WriteRandomFrame(lun,fNbFrames, fVerbose, fDumpsize,MFM_XML_DATA_DESCRIPTION_FRAME_TYPE);
......@@ -1171,6 +1185,7 @@ void WriteUserFrame(int lun, int format, int fNbFrames, int fNbSubFrames) {
fReaTraceframe->WriteRandomFrame(lun,fNbFrames, fVerbose, fDumpsize,MFM_REA_TRACE_FRAME_TYPE);
fSiriusframe->WriteRandomFrame(lun,fNbFrames, fVerbose, fDumpsize,MFM_SIRIUS_FRAME_TYPE);
fDeflectorframe->WriteRandomFrame(lun,fNbFrames, fVerbose, fDumpsize,MFM_S3_DEFLECTOR_FRAME_TYPE);
fParisframe->WriteRandomFrame(lun,fNbFrames, fVerbose, fDumpsize,MFM_PARIS_FRAME_TYPE);
break;
}
//_____________________Merge of Ebyedat in eventnumber_____________________________________________
......@@ -1610,6 +1625,10 @@ void Statistics(bool writeorread) {
fDeflectorframe->PrintStat("Deflector");
cout << "----------------------------------------------" << endl;
}
if (fParisframe->GetCountFrame() != 0) {
fParisframe->PrintStat("Paris");
cout << "----------------------------------------------" << endl;
}
if (fMergeframe->GetCountFrame() != 0) {
fMergeframe->PrintStat("Merge");
fInsideframe->PrintStat("InsideFrame");
......
......@@ -4,7 +4,7 @@ This document relate all points to add a frame in MFM Frame directory and in Gru
In MFM directory
- Generate Frame class code (*.cc and *.h ) This class inherits from MFMBasicFrame or MFMBlobFrame. In few cases,
the heritage came from a other Frame which elseself inherits from MFMBasicFrame or MFMBlobFrame ( example NedaFrame)
- Introduce the new Frame id in MFMType.h
- Introduce the new Frame id in MFMTypes.h
- Add MFMMyNewFrame in CMakeLists.txt
- Add MFMMyNewFrame.h in MFMAllFrames.h
- Add tests in MFMtest.cc to test read and write frames tests
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment