Skip to content

Commit

Permalink
Merge pull request #88 from rest-for-physics/glorialuzon-patch-1
Browse files Browse the repository at this point in the history
minor update due to updated base class
lobis authored Nov 30, 2022
2 parents 51ae0af + f473a44 commit 93a11dd
Showing 4 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion inc/TRestRawMultiCoBoAsAdToSignalProcess.h
Original file line number Diff line number Diff line change
@@ -115,7 +115,7 @@ class TRestRawMultiCoBoAsAdToSignalProcess : public TRestRawToSignalProcess {
public:
void InitProcess() override;

Bool_t AddInputFile(std::string file) override;
Bool_t AddInputFile(const std::string& file) override;

void Initialize() override;

4 changes: 2 additions & 2 deletions inc/TRestRawToSignalProcess.h
Original file line number Diff line number Diff line change
@@ -70,8 +70,8 @@ class TRestRawToSignalProcess : public TRestEventProcess {

void LoadConfig(const std::string& configFilename, const std::string& name = "");

Bool_t OpenInputFiles(std::vector<std::string> files) override;
Bool_t AddInputFile(std::string file) override;
Bool_t OpenInputFiles(const std::vector<std::string>& files) override;
Bool_t AddInputFile(const std::string& file) override;
Bool_t ResetEntry() override;

Long64_t GetTotalBytesRead() const override { return totalBytesReaded; }
15 changes: 9 additions & 6 deletions src/TRestRawMultiCoBoAsAdToSignalProcess.cxx
Original file line number Diff line number Diff line change
@@ -139,7 +139,7 @@ void TRestRawMultiCoBoAsAdToSignalProcess::InitProcess() {
totalBytesReaded = 0;
}

Bool_t TRestRawMultiCoBoAsAdToSignalProcess::AddInputFile(string file) {
Bool_t TRestRawMultiCoBoAsAdToSignalProcess::AddInputFile(const string& file) {
if (file.find(".graw") == -1) {
return false;
}
@@ -302,7 +302,8 @@ bool TRestRawMultiCoBoAsAdToSignalProcess::FillBuffer() {
cout << "TRestRawMultiCoBoAsAdToSignalProcess: retrieving frame header in "
"file "
<< i << " (" << fInputFileNames[i] << ")" << endl;
if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Extreme) fHeaderFrame[i].Show();
if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Extreme)
fHeaderFrame[i].Show();
}

// reading data according to the header
@@ -336,7 +337,8 @@ bool TRestRawMultiCoBoAsAdToSignalProcess::FillBuffer() {
}
totalBytesReaded += 256;
if (!ReadFrameHeader(fHeaderFrame[i])) {
RESTWarning << "Event " << fCurrentEvent << " : error when reading next frame header" << RESTendl;
RESTWarning << "Event " << fCurrentEvent << " : error when reading next frame header"
<< RESTendl;
RESTWarning << "in file " << i << " \"" << fInputFileNames[i] << "\"" << RESTendl;
if (fVerboseLevel > TRestStringOutput::REST_Verbose_Level::REST_Info) fHeaderFrame[i].Show();
RESTWarning << "trying to skip this event and find next header..." << RESTendl;
@@ -353,9 +355,10 @@ bool TRestRawMultiCoBoAsAdToSignalProcess::FillBuffer() {
totalBytesReaded += 256;
if (ReadFrameHeader(fHeaderFrame[i])) {
fVerboseLevel = tmp;
RESTWarning << "Successfully found next header (EventId : " << fHeaderFrame[i].eventIdx
<< ")" << RESTendl;
if (fVerboseLevel > TRestStringOutput::REST_Verbose_Level::REST_Info) fHeaderFrame[i].Show();
RESTWarning << "Successfully found next header (EventId : "
<< fHeaderFrame[i].eventIdx << ")" << RESTendl;
if (fVerboseLevel > TRestStringOutput::REST_Verbose_Level::REST_Info)
fHeaderFrame[i].Show();
cout << endl;
// GetChar();
found = true;
16 changes: 8 additions & 8 deletions src/TRestRawToSignalProcess.cxx
Original file line number Diff line number Diff line change
@@ -134,15 +134,15 @@ void TRestRawToSignalProcess::LoadDefaultConfig() {
fMinPoints = 512;
}

Bool_t TRestRawToSignalProcess::OpenInputFiles(vector<string> files) {
Bool_t TRestRawToSignalProcess::OpenInputFiles(const vector<string>& files) {
nFiles = 0;
fInputFiles.clear();
fInputFileNames.clear();
totalBytes = 0;
totalBytesReaded = 0;

for (int i = 0; i < files.size(); i++) {
AddInputFile(files[i]);
for (const auto& file : files) {
AddInputFile(file);
}

if (nFiles > 0) {
@@ -156,9 +156,9 @@ Bool_t TRestRawToSignalProcess::OpenInputFiles(vector<string> files) {
return nFiles;
}

Bool_t TRestRawToSignalProcess::AddInputFile(string file) {
for (int i = 0; i < fInputFileNames.size(); i++) {
if (fInputFileNames[i] == file) {
Bool_t TRestRawToSignalProcess::AddInputFile(const string& file) {
for (auto& fInputFileName : fInputFileNames) {
if (fInputFileName == file) {
RESTError << "file: \"" << file << "\" already added!" << RESTendl;
return false;
}
@@ -220,8 +220,8 @@ Bool_t TRestRawToSignalProcess::GoToNextFile() {
fclose(fInputBinFile);
fInputBinFile = fopen(fInputFileNames[iCurFile].c_str(), "rb");
}
RESTInfo << "GoToNextFile(): Going to the next raw input file number " << iCurFile << " over " << nFiles
<< RESTendl;
RESTInfo << "GoToNextFile(): Going to the next raw input file number " << iCurFile << " over "
<< nFiles << RESTendl;
RESTInfo << " Reading file name: " << fInputFileNames[iCurFile] << RESTendl;
return true;
} else {

0 comments on commit 93a11dd

Please sign in to comment.