REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestRawMemoryBufferToSignalProcess.h
1/*************************************************************************
2 * This file is part of the REST software framework. *
3 * *
4 * Copyright (C) 2016 GIFNA/TREX (University of Zaragoza) *
5 * For more information see http://gifna.unizar.es/trex *
6 * *
7 * REST is free software: you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation, either version 3 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * REST is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
16 * *
17 * You should have a copy of the GNU General Public License along with *
18 * REST in $REST_PATH/LICENSE. *
19 * If not, see http://www.gnu.org/licenses/. *
20 * For the list of contributors see $REST_PATH/CREDITS. *
21 *************************************************************************/
22
23#ifndef RestCore_TRestRawMemoryBufferToSignalProcess
24#define RestCore_TRestRawMemoryBufferToSignalProcess
25
26#include "TRestEventProcess.h"
27#include "TRestRawSignalEvent.h"
28
29typedef struct {
31 unsigned int dataReady;
32
34 unsigned int nSignals;
35
37 unsigned int eventId;
38
40 double timeStamp;
41
44 unsigned int maxSignals;
45
48 unsigned int maxSamples;
49
52 unsigned int bufferSize;
53
54} daqInfo;
55
59 private:
60#ifndef __CINT__
61
64
67 daqInfo* fShMem_daqInfo;
68
71
74 unsigned short int* fShMem_Buffer;
75
79
83
86 Int_t fKeyBuffer;
87
90 Int_t fTimeDelay;
91
94 Bool_t fReset;
95#endif
96
97 void SemaphoreGreen(int id);
98 void SemaphoreRed(int id);
99
100 void InitFromConfigFile() override;
101
102 void Initialize() override;
103
104 void LoadDefaultConfig();
105
106 protected:
107 public:
108 RESTValue GetInputEvent() const override { return RESTValue((TRestEvent*)nullptr); }
109 RESTValue GetOutputEvent() const override { return fOutputRawSignalEvent; }
110
111 void InitProcess() override;
112
113 void BeginOfEventProcess(TRestEvent* inputEvent = nullptr) override;
114 TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
115
116 void LoadConfig(const std::string& configFilename, const std::string& name = "");
117
119 void PrintMetadata() override {
121
122 EndPrintProcess();
123 }
124
127
129 const char* GetProcessName() const override { return "sharedMemoryBufferToSignalEvent"; }
130
131 // Constructor
133 TRestRawMemoryBufferToSignalProcess(const char* configFilename);
134
135 // Destructor
137
138 ClassDefOverride(TRestRawMemoryBufferToSignalProcess, 1);
139};
140#endif
A base class for any REST event process.
void BeginPrintProcess()
[name, cut range]
A base class for any REST event.
Definition: TRestEvent.h:38
void PrintMetadata() override
It prints out the process parameters stored in the metadata structure.
void SemaphoreRed(int id)
This method will increase the semaphore red level to protect shared memory regions.
void Initialize() override
Function to initialize input/output event members and define the section name.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
void BeginOfEventProcess(TRestEvent *inputEvent=nullptr) override
Function including required initialization before each event starts to process.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
void InitFromConfigFile() override
Function reading input parameters from the RML TRestRawMemoryBufferToSignalProcess metadata section.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
void SemaphoreGreen(int id)
This method will increase the semaphore green level to release shared memory regions.
int fSemaphoreId
It is used internally to control the semaphore.
void InitProcess() override
To be executed at the beginning of the run (outside event loop)
const char * GetProcessName() const override
Returns the name of this process.
TRestRawSignalEvent * fOutputRawSignalEvent
A pointer to the specific TRestRawSignalEvent input.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
TRestEventProcess * Maker()
Returns a new instance of this class.
An event container for time rawdata signals with fixed length.