CbmRoot
Loading...
Searching...
No Matches
CbmMCInput.h
Go to the documentation of this file.
1/* Copyright (C) 2018-2020 GSI Helmholtzzentrum fuer Schwerionenforschung, Darmstadt
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Volker Friese [committer] */
4
10#ifndef CBMMCINPUT_H
11#define CBMMCINPUT_H 1
12
13#include "CbmDefs.h"
14
15#include "TChain.h"
16#include "TF1.h"
17#include "TObject.h"
18
19#include <set>
20
21
33class CbmMCInput : public TObject {
34
35public:
37 CbmMCInput();
38
39
45
46
48 virtual ~CbmMCInput();
49
50
54 std::set<TString>& GetBranchList();
55
56
60 TChain* GetChain() const { return fChain; }
61
62
68 Int_t GetNextEntry();
69
70
74 Int_t GetMaxNofEvents() const { return (fMode == ECbmTreeAccess::kRegular ? fChain->GetEntries() : -1); }
75
76
80 ECbmTreeAccess GetMode() const { return fMode; }
81
82
86 Long64_t GetNofEntries() const { return fChain->GetEntries(); }
87
88
92 UInt_t GetNofUsedEntries() const { return fNofUsedEntries; }
93
94
95private:
96 TChain* fChain;
97 ECbmTreeAccess fMode; // Access mode to tree
98 std::set<TString> fBranches; // List of branch names
99 UInt_t fLastUsedEntry; // Index of last used entry
100 UInt_t fNofUsedEntries; // Number of used entries
101
102
108 UInt_t ReadBranches();
109
110
112};
113
114#endif /* CBMMCINPUT_H */
ECbmTreeAccess
Mode to read entries from a ROOT TTree.
Definition CbmDefs.h:152
An MC (transport) input to digitisation in CBM.
Definition CbmMCInput.h:33
UInt_t fNofUsedEntries
Definition CbmMCInput.h:100
ECbmTreeAccess GetMode() const
Tree access mode @value Access mode.
Definition CbmMCInput.h:80
ECbmTreeAccess fMode
Input chain.
Definition CbmMCInput.h:97
Int_t GetMaxNofEvents() const
Maximal number of events to be read from the input. @value Number of entries in the tree for kRegular...
Definition CbmMCInput.h:74
TChain * fChain
Definition CbmMCInput.h:96
UInt_t fLastUsedEntry
Definition CbmMCInput.h:99
UInt_t GetNofUsedEntries() const
Number of used entries @value Number of successful calls to GetNextEvent()
Definition CbmMCInput.h:92
ClassDef(CbmMCInput, 1)
std::set< TString > fBranches
Definition CbmMCInput.h:98
std::set< TString > & GetBranchList()
List of branches @value Reference to branch list.
TChain * GetChain() const
Pointer to chain @value Pointer to TChain object.
Definition CbmMCInput.h:60
Int_t GetNextEntry()
Get the next unused entry from the chain @value Id of tree entry.
CbmMCInput()
Default constructor.
virtual ~CbmMCInput()
Destructor.
Long64_t GetNofEntries() const
Number of entries @value Number of entries in this input chain.
Definition CbmMCInput.h:86
UInt_t ReadBranches()
Read list of branches from file @value Number of branches.