Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rest daq #35

Draft
wants to merge 43 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7c4fb67
Changes for novel restDAQ package
juanangp Jul 13, 2021
37cb816
Adding enum and maps for different acquisition and electronics
juanangp Jul 29, 2021
d50587d
Fixing baseIP retreival from metadata, now baseIP uses double colon s…
juanangp Jul 30, 2021
01defff
Removing inline since docker image is not c++17 compatible
juanangp Aug 17, 2021
b14812e
Adding fields for FEMINOS
juanangp Aug 23, 2021
22a8a39
Bug fix
juanangp Aug 24, 2021
f72ca05
New containers for FEC and ASIC metadata
juanangp Aug 25, 2021
36b178c
Adding new metadata for single FECs and ASICs
juanangp Aug 25, 2021
ef31d77
Removal of ASICMetadata, not asic parameters are implemented inside F…
juanangp May 30, 2022
8c8f667
Merge branch 'master' of github.com:rest-for-physics/rawlib into rest…
juanangp May 30, 2022
aa7f05a
Merge branch 'master' of github.com:rest-for-physics/rawlib into rest…
juanangp May 31, 2022
27791ad
TRESTDAQMetadata updating documentation
juanangp Jun 2, 2022
42ba207
New method added for a fast retreival of the pulse amplitude after ba…
juanangp Jun 2, 2022
3720f67
Adding documentation to new function GetAmplitudeFast
juanangp Jun 2, 2022
ec74eb6
used new name for number of events `nEvents` instead of `Nevents`
lobis Oct 27, 2022
7d4d6d1
Merge branch 'master' of https://github.com/rest-for-physics/rawlib i…
juanangp Oct 27, 2022
5426df9
Merge branch 'master' into rest_daq
juanangp May 31, 2023
118a294
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 31, 2023
eb2f3be
Removal of FECMetadata class, implementing struct inside TRestRawDAQM…
juanangp May 31, 2023
6bede40
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 31, 2023
7e1c3eb
Adding copy operator to FECMetadata struct
Jun 2, 2023
8656c48
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 2, 2023
1415759
Changing to a more generic FEC metadata structure, adding new variabl…
juanangp Jun 4, 2023
c066761
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 4, 2023
fa8c95d
Bug fix
juanangp Jun 5, 2023
947fb3b
Merge branch 'master' into rest_daq
juanangp Jun 16, 2023
a49af8a
Adding new DAQ metadata maximum file size
juanangp Jun 23, 2023
24d9512
Added new method to remove baseline from zero suppression data
juanangp Jun 23, 2023
a0fba18
New process TRestRawZeroSupressionToRawProcess to remove the baseline…
juanangp Jun 23, 2023
cb43de3
Merge branch 'rest_daq' of github.com:rest-for-physics/rawlib into re…
juanangp Jun 23, 2023
c5f644d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Jun 23, 2023
e46a544
Adding RML example to TRestRawZeroSupressionToRawProcess
juanangp Jun 23, 2023
aa071be
Merge branch 'master' into rest_daq
juanangp Sep 8, 2023
64cb318
Fixing compilation error after recent changes in master
juanangp Sep 8, 2023
36d7e9a
Merge branch 'master' into rest_daq
juanangp Dec 15, 2023
6528512
Adding ARC electronics as electronic type
juanangp Apr 29, 2024
0f330d4
Merge branch 'master' into rest_daq
juanangp Apr 29, 2024
bcab3e4
Adding ARC electronics type to map
Apr 29, 2024
e56761e
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 29, 2024
cb54bfb
Fixing typo
May 30, 2024
10bf1c4
Merge branch 'rest_daq' of github.com:rest-for-physics/rawlib into re…
May 30, 2024
fa69e3f
Adding new macro to cmpute noise and RMS
May 31, 2024
a4662f0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] May 31, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 45 additions & 19 deletions inc/TRestRawDAQMetadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,24 @@
#include "TRestMetadata.h"
#include "TString.h"

namespace daq_metadata_types {

enum class acqTypes : int {
BACKGROUND,
CALIBRATION,
PEDESTAL
};

enum class electronicsTypes : int {
DUMMY,
DCC
};

const std::map<std::string, acqTypes> acqTypes_map = {{"background",acqTypes::BACKGROUND}, {"calibration",acqTypes::CALIBRATION},{"pedestal",acqTypes::PEDESTAL}};
const std::map<std::string, electronicsTypes> electronicsTypes_map = {{"DUMMY",electronicsTypes::DUMMY}, {"DCC",electronicsTypes::DCC}};

}

//! A metadata class to store DAQ information.
class TRestRawDAQMetadata : public TRestMetadata {
private:
Expand All @@ -36,36 +54,44 @@ class TRestRawDAQMetadata : public TRestMetadata {
virtual void Initialize();

protected:
TString fOutBinFileName;
TString fElectronicsType;
std::vector<TString> fPedBuffer; // Pedestal script
std::vector<TString> fRunBuffer; // Run script
TString fNamePedScript; // Name of the run script e.g. /home/user/scripts/run
TString fNameRunScript; // Name of the pedestal script e.g.
// /home/user/scripts/ped
UInt_t fGain; // Value of the gain in the script you have to convert it to fC
UInt_t fShappingTime; // Value of the shapping time in the script you have to
// convert it to nS
TString fElectronicsType; // DCC, FEMINOS, ARC, ...

UInt_t fFECMask; // FEC Mask
UInt_t fGain; // Gain in the AFTER/AGET chip
UInt_t fShappingTime; // Shapping time in the AFTER/AGET chip
UInt_t fClockDiv; // Clock division
Int_t fBaseIp[4] = {192,168,10,13}; //Base IP of the card
TString fTriggerType; // external or internal
TString fAcquisitionType; // pedestal, calibration or background
UInt_t fCompressMode =0; // 0 uncompressed, 1 compress
Int_t fNEvents=0; // 0 --> Infinite

public:
void PrintMetadata();
void PrintRunScript();
void PrintPedScript();
virtual void PrintMetadata();
void ReadBaseIp();

// Construtor
TRestRawDAQMetadata();
TRestRawDAQMetadata(char* cfgFileName);
TRestRawDAQMetadata(const char* cfgFileName);
// Destructor
virtual ~TRestRawDAQMetadata();

void SetScriptsBuffer();
void SetParFromPedBuffer(); // Set gain and shapping time from a given buffer
void SetOutBinFileName(TString fName) { fOutBinFileName = fName; }

UInt_t GetFECMask() { return fFECMask; }
UInt_t GetGain() { return fGain; }
UInt_t GetShappingTime() { return fShappingTime; }
UInt_t GetClockDiv() { return fClockDiv; }
TString GetTriggerType() { return fTriggerType; }
TString GetAcquisitionType() { return fAcquisitionType; }
TString GetElectronicsType() { return fElectronicsType; }
Int_t GetNEvents() { return fNEvents; }
Int_t* GetBaseIp() { return fBaseIp; }
UInt_t GetCompressMode(){return fCompressMode;} // 0 uncompressed, 1 compress
UInt_t GetValFromString(TString var, TString line);
TString GetDecodingFile(){return GetParameter("decodingFile");}

void SetAcquisitionType (const std::string &typ){fAcquisitionType = typ;}
void SetNEvents(const Int_t & nEv){fNEvents=nEv;}

ClassDef(TRestRawDAQMetadata, 1); // REST run class
ClassDef(TRestRawDAQMetadata, 2); // REST run class
};
#endif
1 change: 1 addition & 0 deletions inc/TRestRawSignal.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ class TRestRawSignal : public TObject {

TRestRawSignal();
TRestRawSignal(Int_t nBins);
TRestRawSignal(Int_t sID, std::vector<Short_t> &sData);
~TRestRawSignal();

ClassDef(TRestRawSignal, 1);
Expand Down
131 changes: 32 additions & 99 deletions src/TRestRawDAQMetadata.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,10 @@ ClassImp(TRestRawDAQMetadata);
//______________________________________________________________________________
TRestRawDAQMetadata::TRestRawDAQMetadata() { Initialize(); }

TRestRawDAQMetadata::TRestRawDAQMetadata(char* cfgFileName) : TRestMetadata(cfgFileName) {
TRestRawDAQMetadata::TRestRawDAQMetadata(const char* cfgFileName) : TRestMetadata(cfgFileName) {
Initialize();

LoadConfigFromFile(fConfigFileName);

SetScriptsBuffer();
SetParFromPedBuffer();
}

void TRestRawDAQMetadata::Initialize() {
Expand All @@ -79,115 +76,51 @@ void TRestRawDAQMetadata::Initialize() {
}

//______________________________________________________________________________
TRestRawDAQMetadata::~TRestRawDAQMetadata() { cout << "Deleting TRestRawDAQMetadata" << endl; }
TRestRawDAQMetadata::~TRestRawDAQMetadata() {

}

//______________________________________________________________________________
void TRestRawDAQMetadata::InitFromConfigFile() {
// string daqString;

fNamePedScript = GetParameter("pedScript");
if (fNamePedScript == "") {
cout << "Pedestal script " << endl;
}

fNameRunScript = GetParameter("runScript");
if (fNameRunScript == "") {
cout << "Run script " << endl;
}

fElectronicsType = GetParameter("electronics");
if (fElectronicsType == "") {
cout << "electronic type not found " << endl;
}
}

void TRestRawDAQMetadata::PrintMetadata() {
cout << endl;
cout << "====================================" << endl;
cout << "DAQ : " << GetTitle() << endl;
cout << "Pedestal script : " << fNamePedScript.Data() << endl;
cout << "Run script : " << fNameRunScript.Data() << endl;
cout << "Electronics type : " << fElectronicsType.Data() << endl;
cout << "Gain : " << GetGain() << endl;
cout << "Shapping time : " << GetShappingTime() << endl;
cout << "====================================" << endl;

cout << endl;
}

void TRestRawDAQMetadata::SetScriptsBuffer() {
TString folder = REST_PATH;
folder.Append("data/acquisition/");

TString fName;

fName = folder + fNamePedScript;

ifstream file(fName);
if (!file) {
cout << __PRETTY_FUNCTION__ << " ERROR:FILE " << fName << " not found " << endl;
return;
}
fFECMask = StringToInteger( GetParameter("fecMask") );
fGain = StringToInteger( GetParameter("chipGain") );
fShappingTime = StringToInteger( GetParameter("chipShappingTime") );
fClockDiv = StringToInteger( GetParameter("clockDiv") );
fTriggerType = GetParameter("triggerType");
fAcquisitionType = GetParameter("acquisitionType");
fCompressMode = StringToInteger(GetParameter("compressMode"));
fNEvents = StringToInteger(GetParameter("Nevents"));
ReadBaseIp( );

string line;
while (getline(file, line)) {
fPedBuffer.push_back(line);
}

file.close();

fName = folder + fNameRunScript;

ifstream file2(fName);
if (!file2) {
cout << __PRETTY_FUNCTION__ << " ERROR:FILE " << fName << " not found " << endl;
return;
}

while (getline(file2, line)) {
fRunBuffer.push_back(line);
}

file2.close();
}

void TRestRawDAQMetadata::PrintRunScript() {
for (unsigned int i = 0; i < fRunBuffer.size(); i++) cout << fRunBuffer[i].Data() << endl;
}
void TRestRawDAQMetadata::ReadBaseIp( ){

void TRestRawDAQMetadata::PrintPedScript() {
for (unsigned int i = 0; i < fPedBuffer.size(); i++) cout << fPedBuffer[i].Data() << endl;
std::string ip = GetParameter("baseIp","192.168.10.13");
sscanf(ip.c_str(),"%d:%d:%d:%d",&fBaseIp[0],&fBaseIp[1],&fBaseIp[2],&fBaseIp[3]);
std::cout<<"Base IP: "<<ip<<" --> "<<fBaseIp[0]<<" "<<fBaseIp[1]<<" "<<fBaseIp[2]<<" "<<fBaseIp[3]<<std::endl;
}

void TRestRawDAQMetadata::SetParFromPedBuffer() {
for (unsigned int i = 0; i < fPedBuffer.size(); i++) {
if (fPedBuffer[i].Contains("aget * gain * "))
fGain = GetValFromString("aget * gain * ", fPedBuffer[i]);

if (fPedBuffer[i].Contains("aget * time "))
fShappingTime = GetValFromString("aget * time ", fPedBuffer[i]);

if (fPedBuffer[i].Contains("after * gain * "))
fGain = GetValFromString("after * gain * ", fPedBuffer[i]);

if (fPedBuffer[i].Contains("after * time "))
fShappingTime = GetValFromString("after * time ", fPedBuffer[i]);
}
void TRestRawDAQMetadata::PrintMetadata() {
metadata << "+++++++++++++++++++++++++++++++++++++++++++++" << endl;
metadata << this->ClassName() << " content" << endl;
metadata << "+++++++++++++++++++++++++++++++++++++++++++++" << endl;
metadata << "Base IP : " << fBaseIp[0]<<"."<< fBaseIp[1]<<"."<< fBaseIp[2]<<"."<< fBaseIp[3]<< endl;
metadata << "ElectronicsType : " << fElectronicsType.Data() << endl;
metadata << "FEC mask : 0x"<<std::hex << fFECMask <<std::dec<< endl;
metadata << "Gain : 0x"<<std::hex << fGain <<std::dec<< endl;
metadata << "Shapping time : 0x" <<std::hex << fShappingTime <<std::dec<< endl;
metadata << "Clock div : 0x" <<std::hex << fClockDiv <<std::dec<< endl;
metadata << "Trigger type : " << fTriggerType.Data() << endl;
metadata << "Acquisition type : " << fAcquisitionType.Data() << endl;
metadata << "Number of events : " << fNEvents << endl;
metadata << "+++++++++++++++++++++++++++++++++++++++++++++" << endl;
cout << endl;
}

UInt_t TRestRawDAQMetadata::GetValFromString(TString var, TString line) {
unsigned int val;

unsigned int varSize = var.Sizeof();
unsigned int lineSize = line.Sizeof();

// cout<<varSize<<" "<<lineSize<<endl;

TString diff(line(varSize - 1, lineSize - 1));

cout << diff.Data() << endl;

sscanf(diff.Data(), "0x%x", &val);

return val;
}
4 changes: 4 additions & 0 deletions src/TRestRawSignal.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ TRestRawSignal::TRestRawSignal(Int_t nBins) {
fSignalData.resize(nBins, 0);
}

TRestRawSignal::TRestRawSignal(Int_t sID, std::vector<Short_t> &sData) : fSignalID(sID), fSignalData(sData) {

}

///////////////////////////////////////////////
/// \brief Default destructor
///
Expand Down