NAIA  1.0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups
Event.cpp
Go to the documentation of this file.
1 #include "Chain/Event.h"
2 
3 namespace NAIA {
4 void Event::BranchAll(TTree *tree) {
5  header.Branch(tree);
6  evSummary.Branch(tree);
7 
8  daq.Branch(tree);
9 
10  tofBase.Branch(tree);
11  tofPlus.Branch(tree);
12 
13  tofBaseSt.Branch(tree);
14  tofPlusSt.Branch(tree);
15 
16  ecalBase.Branch(tree);
17  ecalPlus.Branch(tree);
18 
19  trdKBase.Branch(tree);
20  trdKBaseSt.Branch(tree);
21 
22  trTrackBase.Branch(tree);
23  trTrackPlus.Branch(tree);
24 
26  trTrackBaseSt.Branch(tree);
27 
28  richBase.Branch(tree);
29  richPlus.Branch(tree);
30 
31  extHitBase.Branch(tree);
32 
33  if (m_isMC) {
34  mcTruthBase.Branch(tree);
35  mcTruthPlus.Branch(tree);
36  }
37 }
38 
39 void Event::SetAllBranchAddress(TTree *tree) {
42 
43  daq.SetBranchAddress(tree);
44 
47 
50 
53 
56 
59 
62 
65 
67 
68  if (m_isMC) {
71  }
72 }
73 
74 void Event::MirrorBranches(TTree *tree, const Event &sourceEvent) {
75  header.MirrorBranch(tree, &(sourceEvent.header));
76  evSummary.MirrorBranch(tree, &(sourceEvent.evSummary));
77 
78  daq.MirrorBranch(tree, &(sourceEvent.daq));
79 
80  tofBase.MirrorBranch(tree, &(sourceEvent.tofBase));
81  tofPlus.MirrorBranch(tree, &(sourceEvent.tofPlus));
82 
83  tofBaseSt.MirrorBranch(tree, &(sourceEvent.tofBaseSt));
84  tofPlusSt.MirrorBranch(tree, &(sourceEvent.tofPlusSt));
85 
86  ecalBase.MirrorBranch(tree, &(sourceEvent.ecalBase));
87  ecalPlus.MirrorBranch(tree, &(sourceEvent.ecalPlus));
88 
89  trdKBase.MirrorBranch(tree, &(sourceEvent.trdKBase));
90  trdKBaseSt.MirrorBranch(tree, &(sourceEvent.trdKBaseSt));
91 
92  trTrackBase.MirrorBranch(tree, &(sourceEvent.trTrackBase));
93  trTrackPlus.MirrorBranch(tree, &(sourceEvent.trTrackPlus));
94 
95  secondTrTrackBase.MirrorBranch(tree, &(sourceEvent.secondTrTrackBase));
96  trTrackBaseSt.MirrorBranch(tree, &(sourceEvent.trTrackBaseSt));
97 
98  richBase.MirrorBranch(tree, &(sourceEvent.richBase));
99  richPlus.MirrorBranch(tree, &(sourceEvent.richPlus));
100 
101  extHitBase.MirrorBranch(tree, &(sourceEvent.extHitBase));
102 
103  if (sourceEvent.m_isMC) {
104  mcTruthBase.MirrorBranch(tree, &(sourceEvent.mcTruthBase));
105  mcTruthPlus.MirrorBranch(tree, &(sourceEvent.mcTruthPlus));
106  }
107 }
108 
110  header.LoadEvent();
112 
113  daq.LoadEvent();
114 
115  tofBase.LoadEvent();
116  tofPlus.LoadEvent();
117 
120 
123 
126 
129 
132 
135 
137 
138  if (m_isMC) {
141  }
142 }
143 
144 void Event::SetEventNumber(unsigned long long iEv) {
145  header.SetTreeEntry(iEv);
146  evSummary.SetTreeEntry(iEv);
147 
148  daq.SetTreeEntry(iEv);
149 
150  tofBase.SetTreeEntry(iEv);
151  tofPlus.SetTreeEntry(iEv);
152 
153  tofBaseSt.SetTreeEntry(iEv);
154  tofPlusSt.SetTreeEntry(iEv);
155 
156  ecalBase.SetTreeEntry(iEv);
157  ecalPlus.SetTreeEntry(iEv);
158 
159  trdKBase.SetTreeEntry(iEv);
161 
164 
167 
168  richBase.SetTreeEntry(iEv);
169  richPlus.SetTreeEntry(iEv);
170 
172 
173  if (m_isMC) {
176  }
177 }
178 
179 void Event::Clear() {
180  header.Clear();
181  evSummary.Clear();
182 
183  daq.Clear();
184 
185  tofBase.Clear();
186  tofPlus.Clear();
187 
188  tofBaseSt.Clear();
189  tofPlusSt.Clear();
190 
191  ecalBase.Clear();
192  ecalPlus.Clear();
193 
194  trdKBase.Clear();
195  trdKBaseSt.Clear();
196 
197  trTrackBase.Clear();
198  trTrackPlus.Clear();
199 
202 
203  richBase.Clear();
204  richPlus.Clear();
205 
206  extHitBase.Clear();
207 
208  if (m_isMC) {
209  mcTruthBase.Clear();
210  mcTruthPlus.Clear();
211  }
212 
213  LinkContainers();
214 }
215 
221 }
222 } // namespace NAIA
const TrdKBaseData * trdBase
needed to get basic info without computing twice
Definition: UnbExtHit.h:104
void Clear()
Clear container content.
Definition: TrdK.cpp:79
UnbExtHitBase extHitBase
Definition: Event.h:130
void Branch(TTree *tree)
Create the TBranch associated with this container.
TofBase tofBase
Definition: Event.h:108
void Clear()
Clear the container.
Definition: DAQ.cpp:6
void MirrorBranches(TTree *tree, const Event &sourceEvent)
Set all branch addresses for skimming, creates all branches reading from outside Event.
Definition: Event.cpp:74
void Clear()
Clear container content.
Definition: Rich.cpp:109
void Clear()
Clear container content.
Definition: Ecal.cpp:18
const TrTrackBaseData * trkBase
Definition: TrdK.h:142
void BranchAll(TTree *tree)
Forwards this tree to all containers so that each one can create its own branch.
Definition: Event.cpp:4
void Clear()
Clear container content.
Definition: Ecal.cpp:9
void SetAllBranchAddress(TTree *tree)
Forwards this tree to all containers so that each one can create its own branch address for reading o...
Definition: Event.cpp:39
EcalPlus ecalPlus
Definition: Event.h:115
RichPlus richPlus
Definition: Event.h:128
void Clear()
Clear all containers.
Definition: Event.cpp:179
TofPlusStandalone tofPlusSt
Definition: Event.h:112
TrTrackBase trTrackBase
Definition: Event.h:117
void Clear()
Clear container content.
Definition: Tof.cpp:11
void Clear()
Clear container content.
Definition: MCTruth.cpp:38
Event object.
Definition: Event.h:20
MCTruthBase mcTruthBase
Definition: Event.h:132
TrTrackBaseStandalone trTrackBaseSt
Definition: Event.h:122
void Clear()
Clear container content.
Definition: UnbExtHit.cpp:9
void LinkContainers()
Setup dependencies between containers. E.g: TrTrackPlus needs info from TrTrackBase, and so on...
Definition: Event.cpp:216
void ForceReadAllBranches()
Force data reading for all branches. Don't use unless you need it. Rely on read-on-demand instead...
Definition: Event.cpp:109
TrdKBaseStandalone trdKBaseSt
Definition: Event.h:125
EventSummary evSummary
Definition: Event.h:104
DAQ daq
Definition: Event.h:106
SecondTrTrackBase secondTrTrackBase
Definition: Event.h:120
void SetEventNumber(unsigned long long iEv)
Set the Event Number for all containers. The corresponding entry will be loaded upon the first read r...
Definition: Event.cpp:144
Header header
Definition: Event.h:103
void SetTreeEntry(unsigned long long treeEntry)
Set the TTree entry number.
TrdKBase trdKBase
Definition: Event.h:124
void Clear()
Clear container content.
Definition: Tof.cpp:18
void Clear()
Clear container content.
Definition: TrTrack.cpp:27
TrTrackPlus trTrackPlus
Definition: Event.h:118
EcalBase ecalBase
Definition: Event.h:114
void Clear()
Clear container content.
Definition: MCTruth.cpp:10
const TofBaseData * tofBase
Definition: UnbExtHit.h:103
Event class description.
MCTruthPlus mcTruthPlus
Definition: Event.h:133
TofBaseStandalone tofBaseSt
Definition: Event.h:111
void SetBranchAddress(TTree *tree)
Setup reading of the data container.
void Clear()
Clear container content.
void LoadEvent()
Wrapper to call GetEntry on the underlying TBranch.
void MirrorBranch(TTree *targetTree, const T *sourceContainer)
Create a TBranch associated with this container mirroring from an existing container.
bool m_isMC
Definition: Event.h:136
RichBase richBase
Definition: Event.h:127
const TrTrackBaseData * trkBase
Definition: TrTrack.h:201
void Clear()
Clear container content.
Definition: Header.cpp:9
TofPlus tofPlus
Definition: Event.h:109
void Clear()
Clear container content.
Definition: Rich.cpp:8
void Clear()
Clear container content.
Definition: TrTrack.cpp:45