Skip to content

Commit

Permalink
Merge pull request #137 from rest-for-physics/lobis-feminos-daq-to-raw
Browse files Browse the repository at this point in the history
New method to read new mclient root files
  • Loading branch information
lobis authored Aug 19, 2024
2 parents 7fa5fbf + 998e1f1 commit 7375f03
Show file tree
Hide file tree
Showing 26 changed files with 315 additions and 96 deletions.
70 changes: 70 additions & 0 deletions inc/TRestRawFeminosRootToSignalProcess.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*************************************************************************
* This file is part of the REST software framework. *
* *
* Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
* For more information see http://gifna.unizar.es/trex *
* *
* REST is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* REST is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have a copy of the GNU General Public License along with *
* REST in $REST_PATH/LICENSE. *
* If not, see http://www.gnu.org/licenses/. *
* For the list of contributors see $REST_PATH/CREDITS. *
*************************************************************************/

#ifndef RestCore_TRestRawFeminosRootToSignalProcess
#define RestCore_TRestRawFeminosRootToSignalProcess

#include <TRestEventProcess.h>

#include "TRestRawSignalEvent.h"
#include "TRestRawToSignalProcess.h"

///
/// Read data from the root file output of https://github.com/rest-for-physics/feminos-daq into a
/// TRestRawSignalEvent
///

class TRestRawFeminosRootToSignalProcess : public TRestEventProcess {
private:
TRestRawSignalEvent* fSignalEvent = nullptr; //!
Long64_t fInputTreeEntry = 0; //!

TFile* fInputFile = nullptr; //!
TTree* fInputEventTree = nullptr; //!
TTree* fInputRunTree = nullptr; //!

ULong64_t fInputEventTreeTimestamp = 0; //!
std::vector<unsigned short>* fInputEventTreeSignalIds = nullptr; //!
std::vector<unsigned short>* fInputEventTreeSignalValues = nullptr; //!

public:
RESTValue GetInputEvent() const override { return RESTValue((TRestEvent*)nullptr); }
RESTValue GetOutputEvent() const override { return fSignalEvent; }

void InitProcess() override;
void Initialize() override;

TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
const char* GetProcessName() const override { return "FeminosRootToSignal"; }

// Constructor
TRestRawFeminosRootToSignalProcess();
TRestRawFeminosRootToSignalProcess(const char* configFilename);

// Destructor
~TRestRawFeminosRootToSignalProcess();

ClassDefOverride(TRestRawFeminosRootToSignalProcess,
1); // Template for a REST "event process" class inherited from
// TRestEventProcess
};
#endif
4 changes: 2 additions & 2 deletions inc/TRestRawToSignalProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class TRestRawToSignalProcess : public TRestEventProcess {
Int_t fMinPoints;

Double_t tStart;
Long64_t totalBytesReaded;
Long64_t totalbytesRead;
Long64_t totalBytes;

TRestRawSignalEvent* fSignalEvent = nullptr; //!
Expand Down Expand Up @@ -80,7 +80,7 @@ class TRestRawToSignalProcess : public TRestEventProcess {

Bool_t ResetEntry() override;

Long64_t GetTotalBytesRead() const override { return totalBytesReaded; }
Long64_t GetTotalBytesRead() const override { return totalbytesRead; }
Long64_t GetTotalBytes() const override { return totalBytes; }
virtual std::string GetElectronicsType() const { return fElectronicsType; }

Expand Down
6 changes: 3 additions & 3 deletions src/TRestRawAFTERToSignalProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
///
/// <hr>
///
/// \warning **⚠ REST is under continous development.** This documentation
/// \warning **⚠ REST is under continuous development.** This documentation
/// is offered to you by the REST community. Your HELP is needed to keep this code
/// up to date. Your feedback will be worth to support this software, please report
/// any problems/suggestions you may find while using it at [The REST Framework
Expand Down Expand Up @@ -127,7 +127,7 @@ void TRestRawAFTERToSignalProcess::InitProcess() {
runUid[20] = '\0';
sprintf(initTime, "%s", runUid);
printf("File UID is %s \n", initTime);
totalBytesReaded = sizeof(runUid);
totalbytesRead = sizeof(runUid);

int year, day, month, hour, minute, second;
sscanf(runUid, "R%d.%02d.%02d-%02d:%02d:%02d", &year, &month, &day, &hour, &minute, &second);
Expand Down Expand Up @@ -346,7 +346,7 @@ TRestEvent* TRestRawAFTERToSignalProcess::ProcessEvent(TRestEvent* inputEvent) {
RESTDebug << "Trailer " << eventTime << "\n" << RESTendl;

} // end while
totalBytesReaded += frameBits;
totalbytesRead += frameBits;

// printf("Event ID %d time stored
// %.3lf\n",fSignalEvent->GetID(),fSignalEvent->GetTime());
Expand Down
2 changes: 1 addition & 1 deletion src/TRestRawBaseLineCorrectionProcess.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
/// ![A raw signal with and without TRestBaseLineCorrectionProcess with smoothing window size
/// 75](doc_TRestRawBaseLineCorrectionProcess2.png) <hr>
///
/// \warning **⚠ REST is under continous development.** This documentation
/// \warning **⚠ REST is under continuous development.** This documentation
/// is offered to you by the REST community. Your HELP is needed to keep this code
/// up to date. Your feedback will be worth to support this software, please report
/// any problems/suggestions you may find while using it at [The REST Framework
Expand Down
Loading

0 comments on commit 7375f03

Please sign in to comment.