CbmRoot
Loading...
Searching...
No Matches
CbmMCEventFilter.h
Go to the documentation of this file.
1/* Copyright (C) 2019-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer] */
4
10#ifndef CBMMCEVENTFILTER_H
11#define CBMMCEVENTFILTER_H 1
12
13#include "CbmDefs.h"
14
15#include "FairMCApplication.h"
16#include "FairTask.h"
17
18#include "TClonesArray.h"
19
20#include <map>
21#include <string>
22#include <vector>
23
24class TClonesArray;
25
26
41class CbmMCEventFilter : public FairTask {
42
43public:
46
47
49 virtual ~CbmMCEventFilter() {};
50
51
55 Int_t GetNofInputEvents() const { return fNofEventsIn; }
56
57
65 void SetMinNofData(ECbmDataType type, Int_t value) { fMinNofData[type] = value; }
66
67
68protected:
73 TObject* GetData(ECbmDataType type, Int_t index) const;
74
75
80 Int_t GetNofData(ECbmDataType type) const
81 {
82 return (fData.at(type) == nullptr ? 0 : fData.at(type)->GetEntriesFast());
83 }
84
85
89 Bool_t SelectEvent() const;
90
91
92private:
93 std::map<ECbmDataType, TClonesArray*> fData;
94 // std::vector<TClonesArray*> fData; //! Data arrays
95 std::map<ECbmDataType, Int_t> fMinNofData;
98
104 virtual void Exec(Option_t*);
105
106
111 virtual void Finish();
112
113
118 virtual InitStatus Init();
119
120
124 void GetBranch(ECbmDataType type);
125
126
128 std::string Statistics() const;
129
130
135 TString GetBranchName(ECbmDataType type) const;
136
137
139};
140
141#endif /* CBMMCEVENTFILTER_H */
ECbmDataType
Definition CbmDefs.h:90
Class deciding whether to store an MC event.
std::map< ECbmDataType, Int_t > fMinNofData
Data arrays.
void SetMinNofData(ECbmDataType type, Int_t value)
Set a cut on the minimum number of data of a given type.
Int_t fNofEventsOut
Counter: output events.
TString GetBranchName(ECbmDataType type) const
Get branch name from data type.
void GetBranch(ECbmDataType type)
Get a branch from FairRootManager.
virtual ~CbmMCEventFilter()
Destructor.
std::string Statistics() const
Info on number of MC objects in the arrays.
TObject * GetData(ECbmDataType type, Int_t index) const
Get a data object by index.
virtual void Exec(Option_t *)
Execution.
Int_t fNofEventsIn
Counter: input events.
std::map< ECbmDataType, TClonesArray * > fData
virtual void Finish()
Finish (end of run)
ClassDef(CbmMCEventFilter, 2)
Bool_t SelectEvent() const
Event selector method.
Int_t GetNofInputEvents() const
Number of processed events.
Int_t GetNofData(ECbmDataType type) const
Number of data in a branch.
virtual InitStatus Init()
Initialisation.