Skip to content

Commit bb46c4e

Browse files
committed
Initial commit
1 parent 9aaf394 commit bb46c4e

File tree

5 files changed

+289
-0
lines changed

5 files changed

+289
-0
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
set(LibraryVersion "1.0")
2+
add_definitions(-DLIBRARY_VERSION="${LibraryVersion}")
3+
4+
COMPILELIB("")
5+

inc/TRestLegacyProcess.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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_TRestLegacyProcess
24+
#define RestCore_TRestLegacyProcess
25+
26+
#include "TRestEventProcess.h"
27+
28+
//! Base class for legacy process
29+
class TRestLegacyProcess : public TRestEventProcess {
30+
public:
31+
any GetInputEvent() const final { return any((TRestEvent*)nullptr); }
32+
any GetOutputEvent() const final { return any((TRestEvent*)nullptr); }
33+
34+
void InitProcess() final{};
35+
TRestEvent* ProcessEvent(TRestEvent* eventInput) final {
36+
RESTError << "You are trying to execute a legacy process" << RESTendl;
37+
RESTError << "This is not allow, this class is kept for backward compatibility" << RESTendl;
38+
exit(1);
39+
return nullptr;
40+
}
41+
void EndProcess() final{};
42+
43+
/// It prints out the process parameters stored in the metadata structure
44+
void PrintMetadata() override {}
45+
46+
/// Returns the name of this process
47+
const char* GetProcessName() const final { return "legacyProcess"; }
48+
49+
TRestLegacyProcess() {}
50+
TRestLegacyProcess(char* cfgFileName) {}
51+
~TRestLegacyProcess() {}
52+
53+
ClassDefOverride(TRestLegacyProcess, 0);
54+
};
55+
#endif

inc/TRestRawZeroSuppresionProcess.h

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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_TRestRawZeroSuppresionProcess
24+
#define RestCore_TRestRawZeroSuppresionProcess
25+
26+
#include "TRestLegacyProcess.h"
27+
28+
//! A process to identify signal and remove baseline noise from a TRestRawSignalEvent.
29+
class TRestRawZeroSuppresionProcess : public TRestLegacyProcess {
30+
private:
31+
/// The ADC range used for baseline offset definition
32+
TVector2 fBaseLineRange;
33+
34+
/// The ADC range used for integral definition and signal identification
35+
TVector2 fIntegralRange;
36+
37+
/// Number of sigmas over baseline fluctuation to accept a point is over threshold.
38+
Double_t fPointThreshold;
39+
40+
/// A threshold parameter to accept or reject a pre-identified signal. See process description.
41+
Double_t fSignalThreshold;
42+
43+
/// Number of consecutive points over threshold required to accept a signal.
44+
Int_t fNPointsOverThreshold;
45+
46+
Int_t fNPointsFlatThreshold;
47+
48+
/// A parameter to determine if baseline correction has been applied by a previous process
49+
bool fBaseLineCorrection;
50+
51+
/// The ADC sampling used to transform ADC units to physical time in the output TRestDetectorSignalEvent.
52+
/// Given in us.
53+
Double_t fSampling;
54+
55+
public:
56+
/// It prints out the process parameters stored in the metadata structure
57+
void PrintMetadata() override {
58+
BeginPrintProcess();
59+
RESTMetadata << "Base line range definition : ( " << fBaseLineRange.X() << " , " << fBaseLineRange.Y()
60+
<< " ) " << RESTendl;
61+
RESTMetadata << "Integral range : ( " << fIntegralRange.X() << " , " << fIntegralRange.Y() << " ) "
62+
<< RESTendl;
63+
RESTMetadata << "Point Threshold : " << fPointThreshold << " sigmas" << RESTendl;
64+
RESTMetadata << "Signal threshold : " << fSignalThreshold << " sigmas" << RESTendl;
65+
RESTMetadata << "Number of points over threshold : " << fNPointsOverThreshold << RESTendl;
66+
RESTMetadata << "Sampling rate : " << 1. / fSampling << " MHz" << RESTendl;
67+
RESTMetadata << "Max Number of points of flat signal tail : " << fNPointsFlatThreshold << RESTendl;
68+
if (fBaseLineCorrection)
69+
RESTMetadata << "BaseLine correction is enabled for TRestRawSignalAnalysisProcess" << RESTendl;
70+
71+
EndPrintProcess();
72+
}
73+
74+
TRestRawZeroSuppresionProcess() {
75+
RESTWarning << "Creating legacy process TRestRawZeroSuppresionProcess" << RESTendl;
76+
RESTWarning << "This process is now implemented under TRestRawToDetectorSignalProcess" << RESTendl;
77+
}
78+
TRestRawZeroSuppresionProcess(char* cfgFileName) {
79+
RESTWarning << "Creating legacy process TRestRawZeroSuppresionProcess" << RESTendl;
80+
RESTWarning << "This process is now implemented under TRestRawToDetectorSignalProcess" << RESTendl;
81+
}
82+
83+
ClassDefOverride(TRestRawZeroSuppresionProcess, 4);
84+
};
85+
#endif

src/TRestLegacyProcess.cxx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
//////////////////////////////////////////////////////////////////////////
24+
/// The TRestLegacyProcess is the base class for legacy processes, which
25+
/// stands for processes which are not part of REST anymore but they are
26+
/// kept to keep backward compatibility with previous REST realeases.
27+
/// The creation of a legacy process is not allowed, you will have some
28+
/// errors and warnings in case you attempt to run a legacy process.
29+
/// RESTsoft - Software for Rare Event Searches with TPCs
30+
///
31+
///----------------------------------------------------------------------
32+
///
33+
/// REST-for-Physics - Software for Rare Event Searches Toolkit
34+
///
35+
/// History of developments:
36+
///
37+
/// 2022-05: First implementation of TRestLegacyProcess
38+
/// JuanAn Garcia
39+
///
40+
/// \class TRestLegacyProcess
41+
/// \author: JuanAn Garcia. Write full name and e-mail: juanangp@unizar.es
42+
///
43+
/// <hr>
44+
///
45+
46+
#include "TRestLegacyProcess.h"
47+
48+
ClassImp(TRestLegacyProcess);

src/TRestRawZeroSuppresionProcess.cxx

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
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+
//////////////////////////////////////////////////////////////////////////
24+
/// IMPORTANT TRestRawZeroSuppresionProcess is a legacy class, it is just
25+
/// kept for backward compatibility of the code. Do not attempt to create
26+
/// any instance to a legacy process. The information below is kept to
27+
/// have a reference of previous implementations.
28+
///
29+
/// The TRestRawZeroSuppresionProcess identifies the points that are over
30+
/// threshold from the input TRestRawSignalEvent. The resulting points, that
31+
/// are presumed to be a physical signal, will be transported to the output
32+
/// TRestDetectorSignalEvent returned by this process. The data points transferred to
33+
/// the output TRestDetectorSignalEvent will have physical time units related to the
34+
/// sampling rate of the raw signal received as input, and defined as a
35+
/// parameter in this process.
36+
///
37+
/// The different parameters required by this process are:
38+
/// * baselineRange : A 2D-vector definning the range, in number of bins,
39+
/// where the baseline properties will be calculated.
40+
/// * integralRange : A 2D-vector definning the time window, in number of bins,
41+
/// where the signal will be considered.
42+
/// * pointThreshold : The number of sigmas over the baseline flunctuations to
43+
/// consider a point is over the threshold.
44+
/// * pointsOverThreshold : The number of consecutive points over threshold
45+
/// required to consider them as a physical signal.
46+
/// * signalThreshold : The number of sigmas a set of consecutive points
47+
/// identified over threshold must be over the baseline fluctuations to be
48+
/// finally considered a physical signal.
49+
/// * pointsFlatThreshold : A parameter to help removing the un-physical or
50+
/// un-expected tail that follows the physical signal. \TODO more details?
51+
/// * sampling : The time duration of a time bin from the input TRestRawSignalEvent.
52+
/// If no units are specified, the default units, microseconds, will be
53+
/// considered.
54+
///
55+
/// \TODO Add description of observables here.
56+
///
57+
///
58+
/// An example of definition of this process inside a data processing chain,
59+
/// inside the `<TRestProcessRunner>` section.
60+
///
61+
/// The values given between `${}` are enviroment variables that can be defined
62+
/// at the system or at the `<globals>` section. See also TRestMetadata for
63+
/// additional details.
64+
///
65+
/// \code
66+
/// <addProcess type="TRestRawZeroSuppresionProcess" name="zS" value="ON"
67+
/// baseLineRange="(${BL_MIN},${BL_MAX})"
68+
/// integralRange="(${INT_MIN},${INT_MAX})"
69+
/// pointThreshold="${POINT_TH}"
70+
/// pointsOverThreshold="${NPOINTS}"
71+
/// sampling="${SAMPLING}"
72+
/// signalThreshold="${SGNL_TH}"
73+
/// observable="all"
74+
/// verboseLevel="silent" />
75+
/// \endcode
76+
///
77+
///--------------------------------------------------------------------------
78+
///
79+
/// RESTsoft - Software for Rare Event Searches with TPCs
80+
///
81+
/// History of developments:
82+
///
83+
/// 2016-January: Conception and implementation of signal zero suppression
84+
/// process.
85+
/// Javier Galan
86+
///
87+
/// \class TRestRawZeroSuppresionProcess
88+
/// \author Javier Galan
89+
/// \author Kaixiang Ni
90+
///
91+
/// <hr>
92+
///
93+
94+
#include "TRestRawZeroSuppresionProcess.h"
95+
96+
ClassImp(TRestRawZeroSuppresionProcess);

0 commit comments

Comments
 (0)