CbmRoot
CbmMCEventFilter.h
Go to the documentation of this file.
1 
6 #ifndef CBMMCEVENTFILTER_H
7 #define CBMMCEVENTFILTER_H 1
8 
9 #include "CbmDefs.h"
10 #include "FairMCApplication.h"
11 #include "FairTask.h"
12 #include "TClonesArray.h"
13 #include <map>
14 #include <string>
15 #include <vector>
16 
17 class TClonesArray;
18 
19 
34 class CbmMCEventFilter : public FairTask {
35 
36 public:
39 
40 
42  virtual ~CbmMCEventFilter() {};
43 
44 
48  Int_t GetNofInputEvents() const { return fNofEventsIn; }
49 
50 
58  void SetMinNofData(ECbmDataType type, Int_t value) {
59  fMinNofData[type] = value;
60  }
61 
62 
63 protected:
68  TObject* GetData(ECbmDataType type, Int_t index) const;
69 
70 
75  Int_t GetNofData(ECbmDataType type) const {
76  return (fData.at(type) == nullptr ? 0 : fData.at(type)->GetEntriesFast());
77  }
78 
79 
83  Bool_t SelectEvent() const;
84 
85 
86 private:
87  std::map<ECbmDataType, TClonesArray*> fData;
88  // std::vector<TClonesArray*> fData; //! Data arrays
89  std::map<ECbmDataType, Int_t> fMinNofData;
90  Int_t fNofEventsIn;
91  Int_t fNofEventsOut;
92 
98  virtual void Exec(Option_t*);
99 
100 
105  virtual void Finish();
106 
107 
112  virtual InitStatus Init();
113 
114 
118  void GetBranch(ECbmDataType type);
119 
120 
122  std::string Statistics() const;
123 
124 
129  TString GetBranchName(ECbmDataType type) const;
130 
131 
133 };
134 
135 #endif /* CBMMCEVENTFILTER_H */
CbmMCEventFilter
Class deciding whether to store an MC event.
Definition: CbmMCEventFilter.h:34
CbmMCEventFilter::Init
virtual InitStatus Init()
Initialisation.
Definition: CbmMCEventFilter.cxx:67
CbmMCEventFilter::GetBranch
void GetBranch(ECbmDataType type)
Get a branch from FairRootManager.
Definition: CbmMCEventFilter.cxx:84
CbmMCEventFilter::GetNofData
Int_t GetNofData(ECbmDataType type) const
Number of data in a branch.
Definition: CbmMCEventFilter.h:75
CbmMCEventFilter::fNofEventsOut
Int_t fNofEventsOut
Counter: output events.
Definition: CbmMCEventFilter.h:91
CbmMCEventFilter::CbmMCEventFilter
CbmMCEventFilter()
Definition: CbmMCEventFilter.cxx:18
CbmMCEventFilter::GetData
TObject * GetData(ECbmDataType type, Int_t index) const
Get a data object by index.
Definition: CbmMCEventFilter.cxx:28
CbmMCEventFilter::GetBranchName
TString GetBranchName(ECbmDataType type) const
Get branch name from data type.
Definition: CbmMCEventFilter.cxx:101
ECbmDataType
ECbmDataType
Definition: CbmDefs.h:76
CbmMCEventFilter::Exec
virtual void Exec(Option_t *)
Execution.
Definition: CbmMCEventFilter.cxx:36
CbmMCEventFilter::GetNofInputEvents
Int_t GetNofInputEvents() const
Number of processed events.
Definition: CbmMCEventFilter.h:48
CbmMCEventFilter::~CbmMCEventFilter
virtual ~CbmMCEventFilter()
Destructor.
Definition: CbmMCEventFilter.h:42
CbmMCEventFilter::SelectEvent
Bool_t SelectEvent() const
Event selector method.
Definition: CbmMCEventFilter.cxx:122
CbmMCEventFilter::Statistics
std::string Statistics() const
Info on number of MC objects in the arrays.
Definition: CbmMCEventFilter.cxx:142
CbmMCEventFilter::Finish
virtual void Finish()
Finish (end of run)
Definition: CbmMCEventFilter.cxx:54
CbmMCEventFilter::fData
std::map< ECbmDataType, TClonesArray * > fData
Definition: CbmMCEventFilter.h:87
CbmMCEventFilter::fNofEventsIn
Int_t fNofEventsIn
Counter: input events.
Definition: CbmMCEventFilter.h:90
CbmMCEventFilter::ClassDef
ClassDef(CbmMCEventFilter, 2)
CbmMCEventFilter::fMinNofData
std::map< ECbmDataType, Int_t > fMinNofData
Data arrays.
Definition: CbmMCEventFilter.h:89
CbmMCEventFilter::SetMinNofData
void SetMinNofData(ECbmDataType type, Int_t value)
Set a cut on the minimum number of data of a given type.
Definition: CbmMCEventFilter.h:58
CbmDefs.h