REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestRawAFTERToSignalProcess.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_TRestRawAFTERToSignalProcess
24 #define RestCore_TRestRawAFTERToSignalProcess
25 
26 #include "TRestRawToSignalProcess.h"
27 
28 // ATTENTION: new T2K Daq versions 2.X need to read one extra word
29 #define NEW_DAQ_T2K_2_X
30 
31 //--------------------------------------------------------
32 // Structure acquisition data
33 //--------------------------------------------------------
34 struct EventHeader {
35  uint32_t eventSize;
36  uint32_t eventNumb;
37  // int eventTime;
38  // uint16_t dummy;
39 };
40 
41 // ATTENTION!!!!!
42 // New version of the DaqT2K (2.x)
43 // added 30th July 2012 (JuanAn)
44 struct DataPacketHeader {
45  uint16_t size;
46 #ifdef NEW_DAQ_T2K_2_X
47  uint16_t dcc;
48 #endif
49  uint16_t hdr;
50  uint16_t args;
51  uint16_t ts_h;
52  uint16_t ts_l;
53  uint16_t ecnt;
54  uint16_t scnt;
55 };
56 
57 struct DataPacketEnd {
58  uint16_t crc1;
59  uint16_t crc2;
60 };
61 
64  protected:
65  unsigned int prevTime;
66  double reducedTime;
67 
68  public:
69  void Initialize() override;
70  void InitProcess() override;
71  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
72  const char* GetProcessName() const override { return "AFTERToSignal"; }
73  TRestMetadata* GetProcessMetadata() const { return nullptr; }
74 
75  Bool_t isExternal() { return true; }
76 
79 
80  ClassDefOverride(TRestRawAFTERToSignalProcess, 1);
81 };
82 #endif
A base class for any REST event.
Definition: TRestEvent.h:38
A base class for any REST metadata class.
Definition: TRestMetadata.h:74
A process to read binary files produced with AFTER electronics.
~TRestRawAFTERToSignalProcess()
Constructor loading data from a config file.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
void InitProcess() override
Process initialization.
TRestRawAFTERToSignalProcess()
Default constructor.
void Initialize() override
Function to initialize input/output event members and define the section name.
A base class for any process reading a binary external file as input to REST.