88 #include "TRestDetectorTriggerAnalysisProcess.h"
113 if (LoadConfigFromFile(configFilename)) LoadDefaultConfig();
131 SetSectionName(this->ClassName());
132 SetLibraryVersion(LIBRARY_VERSION);
150 if (LoadConfigFromFile(configFilename, name)) LoadDefaultConfig();
157 std::vector<string> fObservables;
158 fObservables = TRestEventProcess::ReadObservables();
160 for (
unsigned int i = 0; i < fObservables.size(); i++)
161 if (fObservables[i].find(
"Integral_Eth") != string::npos)
162 fIntegralObservables.push_back(fObservables[i]);
164 for (
unsigned int i = 0; i < fIntegralObservables.size(); i++) {
165 Double_t th = atof(fIntegralObservables[i].substr(12, fIntegralObservables[i].length() - 12).c_str());
166 fThreshold.push_back(th);
176 for (
int sgnl = 0; sgnl < fInputSignalEvent->GetNumberOfSignals(); sgnl++)
177 fSignalEvent->AddSignal(*fInputSignalEvent->GetSignal(sgnl));
179 vector<Double_t> integral;
180 for (
unsigned int i = 0; i < fIntegralObservables.size(); i++) integral.push_back(0);
182 Int_t maxT = fSignalEvent->GetMaxTime() / fSampling;
183 Int_t minT = fSignalEvent->GetMinTime() / fSampling;
185 Int_t triggerStarts = 0;
187 unsigned int counter = 0;
188 unsigned int nObs = fIntegralObservables.size();
189 for (
int i = minT - fADCLength / 2; i <= maxT && counter < nObs; i++) {
190 Double_t en = fSignalEvent->GetIntegralWithTime(i * fSampling, (i + fADCLength / 2) * fSampling);
192 for (
unsigned int n = 0; n < nObs; n++)
193 if (integral[n] == 0 && en > fThreshold[n]) {
195 if (n == 0) triggerStarts = i;
196 integral[n] = fSignalEvent->GetIntegralWithTime(i * fSampling, (i + fADCLength) * fSampling);
201 for (
unsigned int n = 0; n < nObs; n++)
202 if (integral[n] > 0) counter++;
205 for (
unsigned int i = 0; i < nObs; i++) {
206 SetObservableValue(fIntegralObservables[i], integral[i]);
209 Double_t full = fSignalEvent->GetIntegralWithTime(minT * fSampling - 1, maxT * fSampling + 1);
211 SetObservableValue(
"RawIntegral", full);
212 SetObservableValue(
"TriggerStarts", triggerStarts);
214 if (fSignalEvent->GetNumberOfSignals() <= 0)
return fSignalEvent;
A process to generate integral observables for signal ADC windows found above the defined energy thre...
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
TRestDetectorTriggerAnalysisProcess()
Default constructor.
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.
~TRestDetectorTriggerAnalysisProcess()
Default destructor.
void Initialize() override
Function to initialize input/output event members and define the section name.
void InitProcess() override
Process initialization. Observable names are interpreted here.
A base class for any REST event.
void SetEventInfo(TRestEvent *eve)