Belle II Software development
TOPRecBunch.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <framework/datastore/RelationsObject.h>
12#include <TH1F.h>
13#include <vector>
14#include <framework/gearbox/Const.h>
15
16namespace Belle2 {
27 public:
28
33 c_Unknown = -1,
34 c_Empty = 0,
36 };
37
42 {}
43
48 {
49 m_recBunchNo = 0;
50 m_recTime = 0;
55 m_numTracks = 0;
56 m_usedTracks = 0;
57 m_nodEdx = 0;
58 m_fineSearch = false;
59 m_histograms.clear();
60 m_recValid = false;
61 m_minChi2 = 0;
62 m_detector = Const::invalidDetector;
65 }
66
77 void setReconstructed(int bunchNo, double time,
78 double currentOffset, double currentOffsetError,
79 double averageOffset, double averageOffsetError,
80 Const::EDetector detector)
81 {
82 m_recBunchNo = bunchNo;
83 m_recTime = time;
84 m_currentOffset = currentOffset;
85 m_averageOffset = averageOffset;
86 m_currentOffsetError = currentOffsetError;
87 m_averageOffsetError = averageOffsetError;
88 m_fineSearch = true;
89 m_recValid = true;
90 m_detector = detector;
91 }
92
99 void setNumTracks(int numTracks, int usedTracks, int nodEdx)
100 {
101 m_numTracks = numTracks;
102 m_usedTracks = usedTracks;
103 m_nodEdx = nodEdx;
104 }
105
110 void setRevo9Counter(unsigned short revo9Counter) {m_revo9Counter = revo9Counter;}
111
116 void setMinChi2(double minChi2) {m_minChi2 = minChi2;}
117
122 void addHistogram(const TH1F& histo)
123 {
124 m_histograms.push_back(histo);
125 }
126
132 void setSimulated(int bunchNo, double time)
133 {
134 m_simBunchNo = bunchNo;
135 m_simTime = time;
136 m_simValid = true;
137 }
138
143 void setBucketNumber(int bucketNumber) {m_bucketNumber = bucketNumber;}
144
149 void setBucketFillStatus(bool isFilled) {m_isBucketFilled = isFilled ? c_Filled : c_Empty;}
150
156 int getBunchNo() const {return m_recBunchNo;}
157
166 static int getBucketNumber(int recBunchNo, int revo9Count, int offset, int RFBucketsPerRevolution)
167 {
168 int bn = (recBunchNo + revo9Count * 4 - offset) % RFBucketsPerRevolution;
169 if (bn < 0) bn += RFBucketsPerRevolution;
170 return bn;
171 }
172
179 int getBucketNumber(int offset, unsigned RFBucketsPerRevolution = 5120) const
180 {
181 return getBucketNumber(m_recBunchNo, m_revo9Counter, offset, RFBucketsPerRevolution);
182 }
183
188 int getBucketNumber() const {return m_bucketNumber;}
189
195
201 double getTime() const {return m_recTime;}
202
207 double getCurrentOffset() const {return m_currentOffset;}
208
214
219 double getMinChi2() const {return m_minChi2;}
220
225 double getAverageOffset() const {return m_averageOffset;}
226
232
237 int getNumTracks() const {return m_numTracks;}
238
243 int getUsedTracks() const {return m_usedTracks;}
244
249 int getNodEdxTracks() const {return m_nodEdx;}
250
255 const std::vector<TH1F>& getHistograms() const {return m_histograms;}
256
261 bool isReconstructed() const {return m_recValid;}
262
267 bool isFineSearch() const {return m_fineSearch;}
268
273 int getMCBunchNo() const {return m_simBunchNo;}
274
279 double getMCTime() const {return m_simTime;}
280
285 bool isSimulated() const {return m_simValid;}
286
291 unsigned short getRevo9Counter() const {return m_revo9Counter;}
292
298
299 private:
300
301 int m_recBunchNo = 0;
302 float m_recTime = 0;
303 float m_currentOffset = 0;
304 float m_averageOffset = 0;
307 int m_numTracks = 0;
308 int m_usedTracks = 0;
309 int m_nodEdx = 0;
310 bool m_fineSearch = false;
311 std::vector<TH1F> m_histograms;
312 bool m_recValid = false;
314 int m_simBunchNo = 0;
315 float m_simTime = 0;
316 bool m_simValid = false;
318 unsigned short m_revo9Counter = 0xFFFF;
319 float m_minChi2 = 0;
320 Const::EDetector m_detector = Const::invalidDetector;
327 };
328
329
331} // end namespace Belle2
332
EDetector
Enum for identifying the detector components (detector and subdetector).
Definition: Const.h:42
Defines interface for accessing relations of objects in StoreArray.
Class to store results of TOPBunchFinder.
Definition: TOPRecBunch.h:26
float m_recTime
reconstructed relative bunch time
Definition: TOPRecBunch.h:302
int getBucketNumber() const
Returns reconstructed bucket number stored in private member.
Definition: TOPRecBunch.h:188
Const::EDetector m_detector
component providing the time seed
Definition: TOPRecBunch.h:320
int m_bucketNumber
reconstructed bucket number
Definition: TOPRecBunch.h:322
void setRevo9Counter(unsigned short revo9Counter)
Sets number of system clock tics since last revo9 marker.
Definition: TOPRecBunch.h:110
int getNumTracks() const
Returns number of tracks in acceptance of TOP.
Definition: TOPRecBunch.h:237
double getCurrentOffset() const
Returns current offset to reconstructed bunch.
Definition: TOPRecBunch.h:207
void setBucketFillStatus(bool isFilled)
Sets reconstructed bucket fill status.
Definition: TOPRecBunch.h:149
float m_currentOffset
current offset
Definition: TOPRecBunch.h:303
void addHistogram(const TH1F &histo)
Add histogram.
Definition: TOPRecBunch.h:122
unsigned short getRevo9Counter() const
Returns 127 MHz clock ticks since last revo9 marker.
Definition: TOPRecBunch.h:291
static int getBucketNumber(int recBunchNo, int revo9Count, int offset, int RFBucketsPerRevolution)
Returns reconstructed bucket number within the ring.
Definition: TOPRecBunch.h:166
unsigned short m_revo9Counter
number of system clocks since last revo9 marker
Definition: TOPRecBunch.h:318
bool m_recValid
status of rec
Definition: TOPRecBunch.h:312
void setReconstructed(int bunchNo, double time, double currentOffset, double currentOffsetError, double averageOffset, double averageOffsetError, Const::EDetector detector)
Set reconstructed relative bunch number and time.
Definition: TOPRecBunch.h:77
bool m_fineSearch
if true, fine search was done
Definition: TOPRecBunch.h:310
int getNodEdxTracks() const
Returns number of used tracks without dEdx information.
Definition: TOPRecBunch.h:249
EBucketStatus
Reconstructed bucket status.
Definition: TOPRecBunch.h:32
@ c_Empty
bucket is empty
Definition: TOPRecBunch.h:34
@ c_Unknown
not known
Definition: TOPRecBunch.h:33
@ c_Filled
bucket is filled
Definition: TOPRecBunch.h:35
double getMCTime() const
Returns simulated bunch time (= time used as event start time)
Definition: TOPRecBunch.h:279
float m_averageOffset
running average of offset
Definition: TOPRecBunch.h:304
bool isReconstructed() const
Check if reconstructed return values are valid.
Definition: TOPRecBunch.h:261
float m_minChi2
chi2 value at minimum
Definition: TOPRecBunch.h:319
float m_simTime
simulated relative bunch time
Definition: TOPRecBunch.h:315
double getMinChi2() const
Returns chi2 value at minimum.
Definition: TOPRecBunch.h:219
int m_numTracks
number of tracks in acceptance of TOP
Definition: TOPRecBunch.h:307
int getBunchNo() const
Returns reconstructed bunch number relative to L1 trigger signal at TOP note: depends on the "look ba...
Definition: TOPRecBunch.h:156
int m_nodEdx
number of used tracks with no dEdx information
Definition: TOPRecBunch.h:309
bool isSimulated() const
Check if simulated return values are valid.
Definition: TOPRecBunch.h:285
void setNumTracks(int numTracks, int usedTracks, int nodEdx)
Set number of tracks.
Definition: TOPRecBunch.h:99
double getAverageOffsetError() const
Returns uncertainly of average offset.
Definition: TOPRecBunch.h:231
ClassDef(TOPRecBunch, 7)
ClassDef.
EBucketStatus m_isBucketFilled
reconstructed bucket status
Definition: TOPRecBunch.h:323
void setBucketNumber(int bucketNumber)
Sets reconstructed bucket number.
Definition: TOPRecBunch.h:143
int getMCBunchNo() const
Returns simulated bunch number (= bunch used for the event start time)
Definition: TOPRecBunch.h:273
float m_currentOffsetError
uncertainty of current offset
Definition: TOPRecBunch.h:305
int getBucketNumber(int offset, unsigned RFBucketsPerRevolution=5120) const
Returns reconstructed bucket number within the ring.
Definition: TOPRecBunch.h:179
int m_simBunchNo
simulated relative bunch number
Definition: TOPRecBunch.h:314
int m_recBunchNo
reconstructed relative bunch number
Definition: TOPRecBunch.h:301
double getAverageOffset() const
Returns average offset to reconstructed bunch.
Definition: TOPRecBunch.h:225
void clearReconstructed()
Clear reconstruction data members.
Definition: TOPRecBunch.h:47
bool isFineSearch() const
Check if fine search is done.
Definition: TOPRecBunch.h:267
void setSimulated(int bunchNo, double time)
Set simulated relative bunch number and time.
Definition: TOPRecBunch.h:132
double getCurrentOffsetError() const
Returns uncertainly of current offset.
Definition: TOPRecBunch.h:213
int getUsedTracks() const
Returns number of tracks used for bunch reconstruction.
Definition: TOPRecBunch.h:243
EBucketStatus getBucketFillStatus() const
Returns bucket fill status.
Definition: TOPRecBunch.h:194
std::vector< TH1F > m_histograms
histograms, like chi2 vs t0
Definition: TOPRecBunch.h:311
Const::EDetector getSeedingDetector() const
Returns detector component which provided the time seed.
Definition: TOPRecBunch.h:297
void setMinChi2(double minChi2)
Sets chi2 value at minimum.
Definition: TOPRecBunch.h:116
const std::vector< TH1F > & getHistograms() const
Returns histograms.
Definition: TOPRecBunch.h:255
bool m_simValid
status of sim
Definition: TOPRecBunch.h:316
TOPRecBunch()
Default constructor.
Definition: TOPRecBunch.h:41
double getTime() const
Returns reconstructed bunch time relative to L1 trigger signal at TOP (time to be subtracted to corre...
Definition: TOPRecBunch.h:201
int m_usedTracks
number of tracks used for bunch reconstruction
Definition: TOPRecBunch.h:308
float m_averageOffsetError
uncertainty of running average of offset
Definition: TOPRecBunch.h:306
Abstract base class for different kinds of events.