REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestRawSignalIdTaggingProcess.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_TRestRawSignalIdTaggingProcess
24 #define RestCore_TRestRawSignalIdTaggingProcess
25 
26 #include <TRestRawSignalEvent.h>
27 
28 #include "TRestEventProcess.h"
29 
32  private:
35 
37  std::vector<std::string> fTagNames;
38 
40  std::vector<TVector2> fIdRanges;
41 
43 
45  TVector2 fBaseLineRange = TVector2(-1, -1);
46 
48  Double_t fPointThreshold = -1;
49 
51  Double_t fSignalThreshold = -1;
52 
55 
58  bool fGoodSignalsOnly = false;
59 
60  void Initialize() override;
61  void InitFromConfigFile() override;
62 
63  protected:
64  // add here the members of your event process
65 
66  public:
67  RESTValue GetInputEvent() const override { return fSignalEvent; }
68  RESTValue GetOutputEvent() const override { return fSignalEvent; }
69 
70  void InitProcess() override;
71  TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
72 
73  void PrintMetadata() override {
75 
76  RESTMetadata << "Tag code: " << RESTendl;
77  for (unsigned int n = 0; n < fIdRanges.size(); n++) {
78  RESTMetadata << n + 1 << " - " << fTagNames[n] << ": ( " << fIdRanges[n].X() << ", "
79  << fIdRanges[n].Y() << " )" << RESTendl;
80  }
81  RESTMetadata << " " << RESTendl;
82  RESTMetadata << "Only good signals: " << std::boolalpha << fGoodSignalsOnly << RESTendl;
83 
84  if (fGoodSignalsOnly == true) {
85  RESTMetadata << "Baseline range : ( " << fBaseLineRange.X() << " , " << fBaseLineRange.Y()
86  << " ) " << RESTendl;
87  RESTMetadata << "Point Threshold : " << fPointThreshold << " sigmas" << RESTendl;
88  RESTMetadata << "Signal threshold : " << fSignalThreshold << " sigmas" << RESTendl;
89  RESTMetadata << "Number of points over threshold : " << fPointsOverThreshold << RESTendl;
90  }
91  EndPrintProcess();
92  }
93 
94  const char* GetProcessName() const override { return "RawSignalIdTagging"; }
95 
96  TRestRawSignalIdTaggingProcess(); // Constructor
97  ~TRestRawSignalIdTaggingProcess(); // Destructor
98 
99  ClassDefOverride(TRestRawSignalIdTaggingProcess, 3);
100 };
101 #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
endl_t RESTendl
Termination flag object for TRestStringOutput.
An event container for time rawdata signals with fixed length.
An analysis process helping to assign tags to user defined ranges of signal ids.
std::vector< TVector2 > fIdRanges
A list containing the id range for each tag.
Double_t fSignalThreshold
A parameter to define a minimum signal fluctuation. Measured in sigmas.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
TRestRawSignalEvent * fSignalEvent
A pointer to the specific TRestRawSignalEvent input.
void InitFromConfigFile() override
Process initialization.
void InitProcess() override
Process initialization.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
void Initialize() override
Function to initialize input/output event members and define the section name.
Double_t fPointThreshold
The number of sigmas over baseline fluctuations to identify a point overthreshold.
TVector2 fBaseLineRange
The range where the baseline range will be calculated.
Int_t fPointsOverThreshold
The minimum number of points over threshold to identify a signal as such.
std::vector< std::string > fTagNames
A list containing the tag names for each signal ids range.