REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestDataQualityProcess.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_TRestDataQualityProcess
24#define RestCore_TRestDataQualityProcess
25
26#include "TRestDataQualityRules.h"
27#include "TRestEventProcess.h"
28
31 private:
33 std::vector<UInt_t> fQualityNumber; //<
34
36 std::vector<TString> fQualityTag; //<
37
39 std::vector<TRestDataQualityRules> fRules; //<
40
41 TRestEvent* fEvent = nullptr;
42
43 void InitProcess() override;
44 void EndProcess() override;
45
46 void InitFromConfigFile() override;
47
48 void Initialize() override;
49
50 void LoadDefaultConfig();
51
52 Bool_t EvaluateMetadataRule(TString value, TVector2 range);
53
55 void EnableBit(UInt_t& number, Int_t bitPosition) { number |= (1u << bitPosition); }
56
58 void DisableBit(UInt_t& number, Int_t bitPosition) { number &= ~(1u << bitPosition); };
59
60 Bool_t isBitEnabled(UInt_t number, Int_t bitPosition) { return number & (1u << bitPosition); }
61
62 protected:
63 public:
64 RESTValue GetInputEvent() const override { return fEvent; }
65 RESTValue GetOutputEvent() const override { return fEvent; }
66
67 TRestEvent* ProcessEvent(TRestEvent* inputEvent) override;
68
69 void LoadConfig(const std::string& configFilename, const std::string& name = "");
70
71 void PrintMetadata() override;
72
75
77 const char* GetProcessName() const override { return "dataQuality"; }
78
80 TRestDataQualityProcess(const char* configFilename);
81
83
84 // If new members are added, removed or modified in this class version number must be increased!
85 ClassDefOverride(TRestDataQualityProcess, 1);
86};
87#endif
A process to define and store quality numbers.
~TRestDataQualityProcess()
Default destructor.
void EnableBit(UInt_t &number, Int_t bitPosition)
It sets to 1 the bit of number at position bitPosition
std::vector< UInt_t > fQualityNumber
A std::vector of custom quality numbers.
RESTValue GetOutputEvent() const override
Get pointer to output event. Must be implemented in the derived class.
std::vector< TString > fQualityTag
A std::vector of tag names for each quality number.
void EndProcess() override
Function to use when all events have been processed.
void InitFromConfigFile() override
Function reading input parameters from the RML TRestDataQualityProcess section.
void PrintMetadata() override
It prints out the process parameters stored in the metadata structure.
const char * GetProcessName() const override
Returns the name of this process.
TRestDataQualityProcess()
Default constructor.
void InitProcess() override
Function to use in initialization of process members before starting to process the event.
void LoadDefaultConfig()
Function to load the default config in absence of RML input.
void Initialize() override
Function to initialize input/output event members and define the section name and library version.
TRestEvent * ProcessEvent(TRestEvent *inputEvent) override
The main processing event function.
void DisableBit(UInt_t &number, Int_t bitPosition)
It sets to 0 the bit of number at position bitPosition
std::vector< TRestDataQualityRules > fRules
A std::vector with the rule definitions for each quality number.
void LoadConfig(const std::string &configFilename, const std::string &name="")
Function to load the configuration from an external configuration file.
TRestEventProcess * Maker()
Returns a new instance of this class.
RESTValue GetInputEvent() const override
Get pointer to input event. Must be implemented in the derived class.
A base class for any REST event process.
A base class for any REST event.
Definition: TRestEvent.h:38