60#include "TRestRawDAQMetadata.h"
65TRestRawDAQMetadata::TRestRawDAQMetadata() {
Initialize(); }
67TRestRawDAQMetadata::TRestRawDAQMetadata(
const char* configFilename) :
TRestMetadata(configFilename) {
70 LoadConfigFromFile(fConfigFileName);
73 SetParFromPedBuffer();
81TRestRawDAQMetadata::~TRestRawDAQMetadata() { cout <<
"Deleting TRestRawDAQMetadata" << endl; }
87 if (fNamePedScript ==
"") {
88 cout <<
"Pedestal script " << endl;
92 if (fNameRunScript ==
"") {
93 cout <<
"Run script " << endl;
97 if (fElectronicsType ==
"") {
98 cout <<
"electronic type not found " << endl;
104 cout <<
"====================================" << endl;
105 cout <<
"DAQ : " << GetTitle() << endl;
106 cout <<
"Pedestal script : " << fNamePedScript.Data() << endl;
107 cout <<
"Run script : " << fNameRunScript.Data() << endl;
108 cout <<
"Electronics type : " << fElectronicsType.Data() << endl;
109 cout <<
"Gain : " << GetGain() << endl;
110 cout <<
"Shapping time : " << GetShappingTime() << endl;
111 cout <<
"====================================" << endl;
116void TRestRawDAQMetadata::SetScriptsBuffer() {
117 TString folder = REST_PATH;
118 folder.Append(
"data/acquisition/");
122 fName = folder + fNamePedScript;
124 ifstream file(fName);
126 cout << __PRETTY_FUNCTION__ <<
" ERROR:FILE " << fName <<
" not found " << endl;
131 while (getline(file, line)) {
132 fPedBuffer.push_back(line);
137 fName = folder + fNameRunScript;
139 ifstream file2(fName);
141 cout << __PRETTY_FUNCTION__ <<
" ERROR:FILE " << fName <<
" not found " << endl;
145 while (getline(file2, line)) {
146 fRunBuffer.push_back(line);
152void TRestRawDAQMetadata::PrintRunScript() {
153 for (
unsigned int i = 0; i < fRunBuffer.size(); i++) cout << fRunBuffer[i].Data() << endl;
156void TRestRawDAQMetadata::PrintPedScript() {
157 for (
unsigned int i = 0; i < fPedBuffer.size(); i++) cout << fPedBuffer[i].Data() << endl;
160void TRestRawDAQMetadata::SetParFromPedBuffer() {
161 for (
unsigned int i = 0; i < fPedBuffer.size(); i++) {
162 if (fPedBuffer[i].Contains(
"aget * gain * "))
163 fGain = GetValFromString(
"aget * gain * ", fPedBuffer[i]);
165 if (fPedBuffer[i].Contains(
"aget * time "))
166 fShappingTime = GetValFromString(
"aget * time ", fPedBuffer[i]);
168 if (fPedBuffer[i].Contains(
"after * gain * "))
169 fGain = GetValFromString(
"after * gain * ", fPedBuffer[i]);
171 if (fPedBuffer[i].Contains(
"after * time "))
172 fShappingTime = GetValFromString(
"after * time ", fPedBuffer[i]);
176UInt_t TRestRawDAQMetadata::GetValFromString(TString var, TString line) {
179 unsigned int varSize = var.Sizeof();
180 unsigned int lineSize = line.Sizeof();
182 TString diff(line(varSize - 1, lineSize - 1));
184 cout << diff.Data() << endl;
186 sscanf(diff.Data(),
"0x%x", &val);