REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestRawSignalChannelActivityProcess.cxx
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 
99 #include "TRestRawSignalChannelActivityProcess.h"
100 
101 using namespace std;
102 
104 
109 
114 
120  SetSectionName(this->ClassName());
121  SetLibraryVersion(LIBRARY_VERSION);
122 
123  fSignalEvent = nullptr;
124 }
125 
136  if (!fReadOnly) {
137  fDaqChannelsHisto = new TH1D("daqChannelActivityRaw", "daqChannelActivityRaw", fDaqChannels,
138  fDaqStartChannel, fDaqEndChannel);
139  }
140 }
141 
146  fSignalEvent = (TRestRawSignalEvent*)inputEvent;
147 
148  Int_t Nlow = 0;
149  Int_t Nhigh = 0;
150  for (int s = 0; s < fSignalEvent->GetNumberOfSignals(); s++) {
151  TRestRawSignal* sgnl = fSignalEvent->GetSignal(s);
152  if (sgnl->GetMaxValue() > fHighThreshold) Nhigh++;
153  if (sgnl->GetMaxValue() > fLowThreshold) Nlow++;
154  }
155 
156  for (int s = 0; s < fSignalEvent->GetNumberOfSignals(); s++) {
157  // Adding signal to the channel activity histogram
158  if (!fReadOnly) {
159  Int_t daqChannel = fSignalEvent->GetSignal(s)->GetID();
160  fDaqChannelsHisto->Fill(daqChannel);
161  }
162  }
163 
164  if (GetVerboseLevel() >= TRestStringOutput::REST_Verbose_Level::REST_Debug)
165  fAnalysisTree->PrintObservables();
166 
167  return fSignalEvent;
168 }
169 
176  if (!fReadOnly) {
177  fDaqChannelsHisto->Write();
178  }
179 }
A base class for any REST event.
Definition: TRestEvent.h:38
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
void InitProcess() override
Process initialization. The ROOT TH1 histograms are created here using the limits defined in the proc...
void EndProcess() override
Function to include required actions after all events have been processed. In this process it will ta...
void Initialize() override
Function to initialize input/output event members and define the section name.
An event container for time rawdata signals with fixed length.
It defines a Short_t array with a physical parameter that evolves in time using a fixed time bin.
Int_t GetID() const
Returns the value of signal ID.
Double_t GetMaxValue()
Returns the maximum value found in the data points. It includes baseline correction.
@ REST_Debug
+show the defined debug messages