138#include "TRestRawVetoAnalysisProcess.h"
178 SetName(this->ClassName());
179 SetTitle(
"Default config");
222 if (run !=
nullptr) {
226 map<int, Double_t> VetoMaxPeakAmplitude_map;
227 map<int, Double_t> VetoPeakTime_map;
229 Int_t VetoAboveThreshold = 0;
230 Int_t NVetoAboveThreshold = 0;
231 Int_t VetoInTimeWindow = 0;
232 Int_t NVetoInTimeWindow = 0;
236 VetoMaxPeakAmplitude_map.clear();
237 VetoPeakTime_map.clear();
243 if (fReadoutMetadata ==
nullptr) {
250 for (
int i = 0; i <
fSignalEvent->GetNumberOfSignals(); i++) {
252 auto channelType = fReadoutMetadata->GetTypeForChannelDaqId(signal->
GetID());
254 transform(channelType.begin(), channelType.end(), channelType.begin(), ::toupper);
255 if (channelType ==
"VETO") {
272 fPointsOverThreshold);
280 VetoMaxPeakAmplitude_map[i] = 0;
288 VetoAboveThreshold = 1;
289 NVetoAboveThreshold += 1;
293 VetoInTimeWindow = 1;
294 NVetoInTimeWindow += 1;
317 fPeakTime.push_back(
"PeakTime_" + fVetoGroupName);
318 fPeakAmp.push_back(
"MaxPeakAmplitude_" + fVetoGroupName);
326 for (
double groupId : groupIds) {
334 fPointsOverThreshold);
341 VetoMaxPeakAmplitude_map[groupId] = 0;
349 VetoAboveThreshold = 1;
350 NVetoAboveThreshold += 1;
355 VetoInTimeWindow = 1;
356 NVetoInTimeWindow += 1;
363 VetoMaxPeakAmplitude_map.clear();
364 VetoPeakTime_map.clear();
415 cout <<
"Error: timeWindow has to consist of two comma-separated values." << endl;
420 fSignalThreshold = potpars[1];
421 fPointsOverThreshold = (Int_t)potpars[2];
435 TiXmlElement* vetoDefinition =
GetElement(
"vetoGroup");
437 while (vetoDefinition !=
nullptr) {
445 cout <<
"Error: veto groups and veto IDs defined separately!" << endl;
459 <<
"Veto analysis process will apply to veto signals (to be determined during processing)"
471 RESTMetadata <<
"Veto signal ID: " << i <<
RESTendl;
475 RESTMetadata <<
"All veto signal IDs: ";
476 for (
unsigned int i = 0; i <
fVetoGroupIds.size() - 1; i++) {
487 RESTMetadata <<
"Noise reduction: Points over Threshold parameters = (" <<
fPointThreshold <<
", "
488 << fSignalThreshold <<
", " << fPointsOverThreshold <<
")" <<
RESTendl;
TRestRun * GetRunInfo() const
Return the pointer of the hosting TRestRun object.
void BeginPrintProcess()
[name, cut range]
void SetObservableValue(const std::string &name, const T &value)
Set observable value for AnalysisTree.
A base class for any REST event.
virtual void InitializeReferences(TRestRun *run)
Initialize dynamical references when loading the event from a root file.
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 GetMaxPeakValue()
It returns the amplitude of the signal maximum, baseline will be corrected if CalculateBaseLine was c...
void CalculateBaseLine(Int_t startBin, Int_t endBin, const std::string &option="")
This method calculates the average and fluctuation of the baseline in the specified range and writes ...
std::vector< Int_t > GetPointsOverThreshold() const
Returns a std::vector containing the indexes of data points over threshold.
void InitializePointsOverThreshold(const TVector2 &thrPar, Int_t nPointsOver, Int_t nPointsFlat=512)
It initializes the fPointsOverThreshold array with the indexes of data points that are found over thr...
Int_t GetMaxPeakBin()
It returns the bin at which the maximum peak amplitude happens.
Int_t GetGroupIndex(const std::string &groupName)
Function that returns the index of a specified veto group within the group name vector and ID vector.
~TRestRawVetoAnalysisProcess()
Default destructor.
std::vector< double > fVetoSignalId
Veto signal IDs.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
std::vector< std::string > fPeakTime
Peak Time observable names.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
void Initialize() override
Function to initialize input/output event members and define the section name and library version.
Int_t fThreshold
Threshold of the vetoes.
Double_t fPointThreshold
PointsOverThreshold() Parameters:
void InitProcess() override
Function to use in initialization of process members before starting to process the event.
TRestRawSignalEvent * fSignalEvent
A pointer to the specific TRestRawSignalEvent.
std::vector< std::string > fPeakAmp
Max peak amplitude observable names.
TVector2 fRange
The range used to calculate the veto signal parameters.
std::vector< std::string > fVetoGroupIds
Veto signal IDs per group.
void InitFromConfigFile() override
Function reading input parameters from the RML TRestRawVetoAnalysisProcess section.
TRestRawVetoAnalysisProcess()
Default constructor.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
TVector2 fBaseLineRange
The range used to calculate the baseline parameters from the veto signal.
void PrintMetadata() override
It prints out the process parameters stored in the metadata structure.
std::vector< std::string > fVetoGroupNames
Veto group Names.
std::vector< double > fTimeWindow
Peak time window for cut.
std::string GetGroupIds(const std::string &groupName)
Function that returns a string of the signal IDs for the specified veto group.
@ REST_Extreme
show everything
@ REST_Debug
+show the defined debug messages
Int_t GetChar(std::string hint="Press a KEY to continue ...")
Helps to pause the program, printing a message before pausing.
Int_t StringToInteger(std::string in)
Gets an integer from a string.
TVector2 StringTo2DVector(std::string in)
Gets a 2D-vector from a string.
std::vector< double > StringToElements(std::string in, std::string separator)
Convert the input string into a vector of double elements.