REST-for-Physics  v2.3
Rare Event Searches ToolKit for Physics
TRestCut.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_TRestCut
24 #define RestCore_TRestCut
25 
26 #include "TCut.h"
27 #include "TRestMetadata.h"
28 #include "TRestRun.h"
29 
31 class TRestCut : public TRestMetadata {
32  private:
34  std::vector<TCut> fCuts;
35 
37  std::vector<std::string> fCutStrings;
38 
40  std::vector<std::pair<std::string, std::string> > fParamCut;
41 
42  protected:
43  void Initialize() override;
44  void InitFromConfigFile() override;
45 
46  public:
47  void AddCut(const TCut& cut);
48  TCut GetCut(std::string name);
49 
50  void AddCut(TRestCut* cut);
51 
52  inline auto GetCutStrings() const { return fCutStrings; }
53  inline auto GetParamCut() const { return fParamCut; }
54  inline auto GetCuts() const { return fCuts; }
55 
56  TRestCut& operator=(TRestCut& cut);
57 
58  void PrintMetadata() override;
59 
60  Int_t Write(const char* name, Int_t option, Int_t bufsize) override;
61 
62  // Constructor
63  TRestCut();
64  // Destructor
65  ~TRestCut() {}
66 
67  ClassDefOverride(TRestCut, 2); // Template for a REST "event process" class inherited from
68  // TRestEventProcess
69 };
70 #endif
A class to help on cuts definitions. To be used with TRestAnalysisTree.
Definition: TRestCut.h:31
void PrintMetadata() override
Implemented it in the derived metadata class to print out specific metadata information.
Definition: TRestCut.cxx:157
Int_t Write(const char *name, Int_t option, Int_t bufsize) override
overwriting the write() method with fStore considered
Definition: TRestCut.cxx:167
void Initialize() override
Making default settings.
Definition: TRestCut.cxx:69
void InitFromConfigFile() override
To make settings from rml file. This method must be implemented in the derived class.
Definition: TRestCut.cxx:71
std::vector< TCut > fCuts
Vector of TCuts.
Definition: TRestCut.h:34
std::vector< std::pair< std::string, std::string > > fParamCut
Vector of parameter cuts, first item is parameter and second is the condition.
Definition: TRestCut.h:40
std::vector< std::string > fCutStrings
Vector of cut strings e.g. when you use a complex cut.
Definition: TRestCut.h:37
A base class for any REST metadata class.
Definition: TRestMetadata.h:74