forked from AliceO2Group/AliceO2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRecPoints.h
More file actions
133 lines (117 loc) · 4.59 KB
/
RecPoints.h
File metadata and controls
133 lines (117 loc) · 4.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
/// \file RecPoints.h
/// \brief Definition of the FV0 RecPoints class
#ifndef ALICEO2_FV0_RECPOINTS_H
#define ALICEO2_FV0_RECPOINTS_H
#include "CommonDataFormat/InteractionRecord.h"
#include "CommonDataFormat/RangeReference.h"
#include "DataFormatsFV0/Digit.h"
#include "DataFormatsFIT/ChannelDataBit.h"
#include <array>
#include <gsl/span>
namespace o2
{
namespace fv0
{
struct ChannelDataFloat {
static constexpr int DUMMY_CHANNEL_ID = -1;
static constexpr int DUMMY_CHAIN_QTC = -1;
static constexpr double DUMMY_CFD_TIME = -20000.0;
static constexpr double DUMMY_QTC_AMPL = -20000.0;
int channel = DUMMY_CHANNEL_ID; ///< Channel ID
float time = DUMMY_CFD_TIME; ///< Channel time (ns), 0 at the LHC clock center
float charge = DUMMY_QTC_AMPL; ///< Channel charge (ADC channels)
int adcId = DUMMY_CHAIN_QTC; ///< Channel data bits
ChannelDataFloat() = default;
ChannelDataFloat(int Channel, double Time, double Charge, int AdcId)
{
channel = Channel;
time = Time;
charge = Charge;
adcId = AdcId;
}
static void setFlag(fit::ChannelDataBit bitFlag, int& adcId)
{
adcId = adcId | (1 << bitFlag);
}
static void clearFlag(fit::ChannelDataBit bitFlag, int& adcId)
{
adcId = adcId & (~(1 << bitFlag));
}
void setFlags(int flag)
{
adcId = flag;
}
void setFlag(fit::ChannelDataBit bitFlag, bool value = true)
{
adcId = (adcId & (~(1 << bitFlag))) | (int(value) << bitFlag);
}
bool getFlag(fit::ChannelDataBit bitFlag) const
{
return bool(adcId & (1 << bitFlag));
}
bool areAllFlagsGood() const
{
return (!getFlag(fit::ChannelDataBit::kIsDoubleEvent) &&
!getFlag(fit::ChannelDataBit::kIsTimeInfoNOTvalid) &&
getFlag(fit::ChannelDataBit::kIsCFDinADCgate) &&
!getFlag(fit::ChannelDataBit::kIsTimeInfoLate) &&
!getFlag(fit::ChannelDataBit::kIsAmpHigh) &&
getFlag(fit::ChannelDataBit::kIsEventInTVDC) &&
!getFlag(fit::ChannelDataBit::kIsTimeInfoLost));
}
void print() const;
int getChannelId() const { return channel; }
double getTime() const { return time; }
double getAmp() const { return charge; }
bool operator==(const ChannelDataFloat&) const = default;
ClassDefNV(ChannelDataFloat, 1);
};
class RecPoints
{
public:
enum TimeTypeIndex : int { TimeFirst,
TimeGlobalMean,
TimeSelectedMean };
RecPoints() = default;
RecPoints(const std::array<short, 3>& collisiontime, int first, int ne,
o2::InteractionRecord iRec, o2::fit::Triggers triggers)
: mCollisionTimePs(collisiontime)
{
mRef.setFirstEntry(first);
mRef.setEntries(ne);
mIntRecord = iRec;
mTriggers = triggers;
}
~RecPoints() = default;
float getCollisionTime(TimeTypeIndex type) const { return mCollisionTimePs[type]; }
float getCollisionFirstTime() const { return getCollisionTime(TimeFirst); }
float getCollisionGlobalMeanTime() const { return getCollisionTime(TimeGlobalMean); }
float getCollisionSelectedMeanTime() const { return getCollisionTime(TimeSelectedMean); }
bool isValidTime(TimeTypeIndex type) const { return getCollisionTime(type) < sDummyCollissionTime; }
void setCollisionTime(Float_t time, TimeTypeIndex type) { mCollisionTimePs[type] = time; }
o2::fit::Triggers getTrigger() const { return mTriggers; }
o2::InteractionRecord getInteractionRecord() const { return mIntRecord; };
gsl::span<const ChannelDataFloat> getBunchChannelData(const gsl::span<const ChannelDataFloat> tfdata) const;
short static constexpr sDummyCollissionTime = 32767;
void print() const;
bool operator==(const RecPoints&) const = default;
private:
o2::dataformats::RangeReference<int, int> mRef;
o2::InteractionRecord mIntRecord;
o2::fit::Triggers mTriggers; // pattern of triggers in this BC
std::array<short, 3> mCollisionTimePs = {sDummyCollissionTime, sDummyCollissionTime, sDummyCollissionTime}; // in picoseconds
ClassDefNV(RecPoints, 1);
};
} // namespace fv0
} // namespace o2
#endif