1 |
+ |
// Dear emacs, this is -*- c++ -*- |
2 |
|
#ifndef Selection_H |
3 |
|
#define Selection_H |
4 |
|
|
5 |
+ |
#include <TString.h> |
6 |
|
#include "Objects.h" |
7 |
|
#include "BaseCycleContainer.h" |
8 |
< |
#include "core/include/SLogger.h" |
8 |
> |
#include "ObjectHandler.h" |
9 |
> |
#include "../../core/include/SLogger.h" |
10 |
> |
|
11 |
> |
/** |
12 |
> |
* @short basic class for selection modules |
13 |
> |
* @author Thomas Peiffer |
14 |
> |
*/ |
15 |
|
|
16 |
|
class SelectionModule{ |
17 |
|
public: |
18 |
+ |
//Default constructor |
19 |
|
SelectionModule(){}; |
20 |
+ |
//Default destructor |
21 |
|
virtual ~SelectionModule(){}; |
22 |
|
|
23 |
|
virtual bool pass(BaseCycleContainer*)=0; |
24 |
|
virtual std::string description()=0; |
25 |
|
}; |
26 |
|
|
27 |
+ |
/** |
28 |
+ |
* @short basic class for a selection |
29 |
+ |
* |
30 |
+ |
* contains a list of SelectionModules |
31 |
+ |
* and produces cut flow tables |
32 |
+ |
* |
33 |
+ |
* @author Thomas Peiffer |
34 |
+ |
*/ |
35 |
|
|
36 |
|
class Selection{ |
37 |
|
public: |
38 |
|
|
39 |
|
//Selection(){}; |
40 |
< |
Selection(std::string name = "Selection"); |
40 |
> |
/// Default constructor |
41 |
> |
Selection(std::string name); |
42 |
> |
/// Default destructor |
43 |
|
~Selection(){}; |
44 |
|
|
45 |
+ |
/// add a new SelectionModule to the event selection |
46 |
|
void addSelectionModule(SelectionModule*); |
47 |
+ |
/// remove all booked SelectionModules |
48 |
|
void clearSelectionModulesList(); |
49 |
+ |
/// set all entries in the cut flow table to 0 |
50 |
+ |
void resetCutFlow(); |
51 |
+ |
|
52 |
+ |
/** |
53 |
+ |
* loop over all booked SelectionModules and call the pass() routine of each module for a given BaseCycleContainer |
54 |
+ |
* @see passSelection() |
55 |
+ |
* @see SelectionModule::pass(BaseCycleContainer*) |
56 |
+ |
*/ |
57 |
|
bool passSelection(BaseCycleContainer *bcc); |
58 |
|
bool passInvertedSelection(BaseCycleContainer *bcc); |
59 |
+ |
/** |
60 |
+ |
* same as passSelection(BaseCycleContainer *bcc) but takes BaseCycleContainer from ObjectHandler |
61 |
+ |
* @see passSelection(BaseCycleContainer *bcc) |
62 |
+ |
*/ |
63 |
+ |
bool passSelection(); |
64 |
+ |
bool passInvertedSelection(); |
65 |
+ |
|
66 |
+ |
/** |
67 |
+ |
* enable or disable the selection, the selection is enabled by default |
68 |
+ |
*/ |
69 |
+ |
void DisableSelection(){m_isactive = false;} |
70 |
+ |
void EnableSelection(){m_isactive = true;} |
71 |
+ |
bool IsActive(){return m_isactive;} |
72 |
|
|
73 |
+ |
/// print the cut-flow table for the booked SelectionModules, to be called in the EndInputData routine of a cycle |
74 |
|
void printCutFlow(); |
75 |
|
|
76 |
+ |
TString GetName() {return m_name;} |
77 |
+ |
void SetName(TString name) { m_name = name;} |
78 |
+ |
|
79 |
|
private: |
80 |
+ |
TString m_name; |
81 |
|
mutable SLogger m_logger; |
82 |
|
std::vector<SelectionModule*> m_cuts; |
83 |
|
std::vector<int> m_cutflow; |
84 |
+ |
int Ntotal; |
85 |
+ |
bool m_isactive; |
86 |
+ |
|
87 |
|
}; |
88 |
|
|
89 |
|
|
90 |
|
|
91 |
< |
#endif |
91 |
> |
#endif // Selection_H |