Skip to content

Commit 92ad52b

Browse files
ZDC-like Digits and RecPoints structure (#2926)
* ZDC like BCdata and ChannelData * add Digits and Channel data * new structure Digits and RecPoints: vector of span * vector of spans in workflow * cleaning according reviewer's comments * non bit strigger structure * another trigger implementation * non-bitset trigger structure * new TCM data structure * use span for Digits in FT0ReconstructorSpec * check for correct data after reading file with real data * change digitizer for future vectorization * start implementing simd * speed-up digitzation Co-authored-by: David Rohr <github@jwdt.org>
1 parent d0d2b4e commit 92ad52b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1202
-897
lines changed

DataFormats/Detectors/FIT/FT0/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,19 @@
99
# submit itself to any jurisdiction.
1010

1111
o2_add_library(DataFormatsFT0
12-
SOURCES src/Digit.cxx src/RecPoints.cxx src/RawEventData.cxx
12+
SOURCES src/Digit.cxx
13+
SOURCES src/DigitsTemp.cxx
14+
SOURCES src/ChannelData.cxx
15+
SOURCES src/RecPoints.cxx
16+
SOURCES src/RawEventData.cxx
1317
PUBLIC_LINK_LIBRARIES O2::CommonDataFormat O2::Headers
1418
O2::SimulationDataFormat O2::FT0Base
1519
)
1620

1721
o2_target_root_dictionary(DataFormatsFT0
1822
HEADERS include/DataFormatsFT0/Digit.h
23+
include/DataFormatsFT0/DigitsTemp.h
24+
include/DataFormatsFT0/ChannelData.h
1925
include/DataFormatsFT0/RecPoints.h
2026
include/DataFormatsFT0/MCLabel.h
2127
include/DataFormatsFT0/HitType.h
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
/// \file ChannelData.h
12+
/// \brief Class to describe fired and stored channels for the BC and to refer to channel data
13+
/// \author Alla.Maevskaya@cern.ch
14+
15+
#ifndef _FT0_CHANNELDATA_H_
16+
#define _FT0_CHANNELDATA_H_
17+
18+
#include <Rtypes.h>
19+
20+
namespace o2
21+
{
22+
namespace ft0
23+
{
24+
struct ChannelData {
25+
26+
uint8_t ChId = 0xff; //channel Id
27+
uint8_t ChainQTC = 0xff; //QTC chain
28+
int16_t CFDTime = -1000; //time in #CFD channels, 0 at the LHC clk center
29+
int16_t QTCAmpl = -1000; // Amplitude #channels
30+
31+
ChannelData() = default;
32+
ChannelData(uint8_t iPmt, int time, int charge, uint8_t chainQTC)
33+
{
34+
ChId = iPmt;
35+
CFDTime = time;
36+
QTCAmpl = charge;
37+
ChainQTC = chainQTC;
38+
}
39+
40+
void print() const;
41+
42+
ClassDefNV(ChannelData, 1);
43+
};
44+
} // namespace ft0
45+
} // namespace o2
46+
#endif

DataFormats/Detectors/FIT/FT0/include/DataFormatsFT0/Digit.h

Lines changed: 76 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -8,105 +8,103 @@
88
// granted to it by virtue of its status as an Intergovernmental Organization
99
// or submit itself to any jurisdiction.
1010

11-
#ifndef ALICEO2_FIT_DIGIT_H
12-
#define ALICEO2_FIT_DIGIT_H
11+
// \file Digit.h
12+
/// \brief Class to describe fired triggered and/or stored channels for the BC and to refer to channel data
13+
/// \author Alla.Maevskaya@cern.ch
14+
15+
#ifndef _FT0_DIGIT_H_
16+
#define _FT0_DIGIT_H_
1317

1418
#include "CommonDataFormat/InteractionRecord.h"
19+
#include "CommonDataFormat/RangeReference.h"
1520
#include "CommonDataFormat/TimeStamp.h"
16-
#include <iosfwd>
17-
#include "Rtypes.h"
21+
#include "DataFormatsFT0/ChannelData.h"
22+
#include <Rtypes.h>
23+
#include <gsl/span>
24+
#include <bitset>
1825

1926
namespace o2
2027
{
2128
namespace ft0
2229
{
23-
24-
struct ChannelData {
25-
Int_t ChId; //channel Id
26-
// Double_t CFDTime; //time in ns, 0 at lhc clk center
27-
// Double_t QTCAmpl; // Amplitude in mips
28-
int CFDTime; //time in ns, 0 at lhc clk center
29-
int QTCAmpl; // Amplitude in mips
30-
int numberOfParticles;
31-
ClassDefNV(ChannelData, 2);
32-
};
33-
34-
/// \class Digit
35-
/// \brief FIT digit implementation
36-
using DigitBase = o2::dataformats::TimeStamp<double>;
37-
class Digit : public DigitBase
38-
{
39-
public:
40-
Digit() = default;
41-
42-
Digit(std::vector<ChannelData> ChDgDataArr, Double_t time, uint16_t bc, uint32_t orbit, Bool_t isA,
43-
Bool_t isC, Bool_t isCnt, Bool_t isSCnt, Bool_t isVrtx)
30+
class ChannelData;
31+
32+
struct Triggers {
33+
uint8_t triggersignals; // T0 trigger signals
34+
int8_t nChanA; // number of faired channels A side
35+
int8_t nChanC; // number of faired channels A side
36+
int32_t amplA; // sum amplitude A side
37+
int32_t amplC; // sum amplitude C side
38+
int16_t timeA; // average time A side
39+
int16_t timeC; // average time C side
40+
Triggers() = default;
41+
Triggers(uint8_t signals, int8_t chanA, int8_t chanC, int32_t aamplA, int32_t aamplC, int16_t atimeA, int16_t atimeC)
4442
{
45-
setChDgData(std::move(ChDgDataArr));
46-
setTime(time);
47-
setInteractionRecord(bc, orbit);
48-
setTriggers(isA, isC, isCnt, isSCnt, isVrtx);
43+
triggersignals = signals;
44+
nChanA = chanA;
45+
nChanC = chanC;
46+
amplA = aamplA;
47+
amplC = aamplC;
48+
timeA = atimeA;
49+
timeC = atimeC;
4950
}
50-
51-
~Digit() = default;
52-
53-
Double_t getTime() const { return mTime; }
54-
void setTime(Double_t time) { mTime = time; }
55-
56-
void setInteractionRecord(uint16_t bc, uint32_t orbit)
51+
bool getOrA() { return (triggersignals & (1 << 0)) != 0; }
52+
bool getOrC() { return (triggersignals & (1 << 1)) != 0; }
53+
bool getVertex() { return (triggersignals & (1 << 2)) != 0; }
54+
bool getCen() { return (triggersignals & (1 << 3)) != 0; }
55+
bool getSCen() { return (triggersignals & (1 << 4)) != 0; }
56+
57+
void setTriggers(Bool_t isA, Bool_t isC, Bool_t isCnt, Bool_t isSCnt, Bool_t isVrtx, int8_t chanA, int8_t chanC, int32_t aamplA,
58+
int32_t aamplC, int16_t atimeA, int16_t atimeC)
5759
{
58-
mIntRecord.bc = bc;
59-
mIntRecord.orbit = orbit;
60+
triggersignals = triggersignals | (isA ? (1 << 0) : 0);
61+
triggersignals = triggersignals | (isC ? (1 << 1) : 0);
62+
triggersignals = triggersignals | (isVrtx ? (1 << 2) : 0);
63+
triggersignals = triggersignals | (isSCnt ? (1 << 3) : 0);
64+
triggersignals = triggersignals | (isCnt ? (1 << 4) : 0);
65+
nChanA = chanA;
66+
nChanC = chanC;
67+
amplA = aamplA;
68+
amplC = aamplC;
69+
timeA = atimeA;
70+
timeC = atimeC;
6071
}
61-
const o2::InteractionRecord& getInteractionRecord() const { return mIntRecord; }
62-
o2::InteractionRecord& getInteractionRecord(o2::InteractionRecord& src) { return mIntRecord; }
63-
void setInteractionRecord(const o2::InteractionRecord& src) { mIntRecord = src; }
64-
uint32_t getOrbit() const { return mIntRecord.orbit; }
65-
uint16_t getBC() const { return mIntRecord.bc; }
66-
67-
Bool_t getisA() const { return mIsA; }
68-
Bool_t getisC() const { return mIsC; }
69-
Bool_t getisCnt() const { return mIsCentral; }
70-
Bool_t getisSCnt() const { return mIsSemiCentral; }
71-
Bool_t getisVrtx() const { return mIsVertex; }
72-
73-
void setTriggers(Bool_t isA, Bool_t isC, Bool_t isCnt, Bool_t isSCnt, Bool_t isVrtx)
72+
void cleanTriggers()
7473
{
75-
mIsA = isA;
76-
mIsC = isC;
77-
mIsCentral = isCnt;
78-
mIsSemiCentral = isSCnt;
79-
mIsVertex = isVrtx;
74+
triggersignals = 0;
75+
nChanA = nChanC = -1;
76+
amplA = amplC = -1000;
77+
timeA = timeC = -1000;
8078
}
8179

82-
const std::vector<ChannelData>& getChDgData() const { return mChDgDataArr; }
83-
std::vector<ChannelData>& getChDgData() { return mChDgDataArr; }
84-
void setChDgData(const std::vector<ChannelData>& ChDgDataArr) { mChDgDataArr = ChDgDataArr; }
85-
void setChDgData(std::vector<ChannelData>&& ChDgDataArr) { mChDgDataArr = std::move(ChDgDataArr); }
80+
Triggers getTriggers();
8681

87-
void printStream(std::ostream& stream) const;
88-
void cleardigits()
89-
{
90-
mIsA = mIsC = mIsCentral = mIsSemiCentral = mIsVertex = 0;
91-
mChDgDataArr.clear();
92-
}
82+
ClassDefNV(Triggers, 1);
83+
};
9384

94-
private:
95-
Double_t mTime; // time stamp
96-
o2::InteractionRecord mIntRecord; // Interaction record (orbit, bc)
85+
struct Digit {
86+
o2::dataformats::RangeRefComp<5> ref;
9787

98-
//online triggers processed on TCM
99-
Bool_t mIsA, mIsC;
100-
Bool_t mIsCentral;
101-
Bool_t mIsSemiCentral;
102-
Bool_t mIsVertex;
88+
Triggers mTriggers; // pattern of triggers in this BC
89+
o2::InteractionRecord mIntRecord; // Interaction record (orbit, bc)
10390

104-
std::vector<ChannelData> mChDgDataArr;
91+
Digit() = default;
92+
Digit(int first, int ne, o2::InteractionRecord iRec, Triggers chTrig)
93+
{
94+
ref.setFirstEntry(first);
95+
ref.setEntries(ne);
96+
mIntRecord = iRec;
97+
mTriggers = chTrig;
98+
}
99+
uint32_t getOrbit() const { return mIntRecord.orbit; }
100+
uint16_t getBC() const { return mIntRecord.bc; }
101+
o2::InteractionRecord getIntRecord() { return mIntRecord; };
102+
gsl::span<const ChannelData> getBunchChannelData(const gsl::span<const ChannelData> tfdata) const;
103+
void printStream(std::ostream& stream) const;
105104

106-
ClassDefNV(Digit, 1);
105+
ClassDefNV(Digit, 2);
107106
};
108-
109-
std::ostream& operator<<(std::ostream& stream, const Digit& digi);
110107
} // namespace ft0
111108
} // namespace o2
109+
112110
#endif
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
// Copyright CERN and copyright holders of ALICE O2. This software is
2+
// distributed under the terms of the GNU General Public License v3 (GPL
3+
// Version 3), copied verbatim in the file "COPYING".
4+
//
5+
// See http://alice-o2.web.cern.ch/license for full licensing information.
6+
//
7+
// In applying this license CERN does not waive the privileges and immunities
8+
// granted to it by virtue of its status as an Intergovernmental Organization
9+
// or submit itself to any jurisdiction.
10+
11+
#ifndef ALICEO2_FIT_DIGIT_H
12+
#define ALICEO2_FIT_DIGIT_H
13+
14+
#include "CommonDataFormat/InteractionRecord.h"
15+
#include "CommonDataFormat/TimeStamp.h"
16+
#include "DataFormatsFT0/Digit.h"
17+
#include "DataFormatsFT0/ChannelData.h"
18+
#include <iosfwd>
19+
#include "Rtypes.h"
20+
21+
namespace o2
22+
{
23+
namespace ft0
24+
{
25+
26+
/// \class Digit
27+
/// \brief FIT digit implementation for
28+
29+
using DigitBase = o2::dataformats::TimeStamp<double>;
30+
class DigitsTemp : public DigitBase
31+
{
32+
public:
33+
DigitsTemp() = default;
34+
35+
DigitsTemp(std::vector<ChannelData> ChDgDataArr, Double_t time, uint16_t bc, uint32_t orbit, o2::ft0::Triggers trigger)
36+
: mChDgDataArr(std::move(ChDgDataArr)),
37+
mTrigger(trigger)
38+
{
39+
setTime(time);
40+
setInteractionRecord(bc, orbit);
41+
}
42+
~DigitsTemp() = default;
43+
44+
Double_t getTime() const { return mTime; }
45+
void setTime(Double_t time) { mTime = time; }
46+
47+
void setInteractionRecord(uint16_t bc, uint32_t orbit)
48+
{
49+
mIntRecord.bc = bc;
50+
mIntRecord.orbit = orbit;
51+
}
52+
const o2::InteractionRecord& getInteractionRecord() const { return mIntRecord; }
53+
o2::InteractionRecord& getInteractionRecord(o2::InteractionRecord& src) { return mIntRecord; }
54+
void setInteractionRecord(const o2::InteractionRecord& src) { mIntRecord = src; }
55+
uint32_t getOrbit() const { return mIntRecord.orbit; }
56+
uint16_t getBC() const { return mIntRecord.bc; }
57+
58+
o2::ft0::Triggers mTrigger; //online triggers processed on TCM
59+
void setTriggers(Bool_t isA, Bool_t isC, Bool_t isCnt, Bool_t isSCnt, Bool_t isVrtx, uint8_t chanA, uint8_t chanC, uint16_t aamplA, uint16_t aamplC, uint16_t atimeA, uint16_t atimeC)
60+
{
61+
auto trig = mTrigger.triggersignals;
62+
trig = trig | (isA ? (1 << 0) : 0);
63+
trig = trig | (isC ? (1 << 1) : 0);
64+
trig = trig | (isVrtx ? (1 << 2) : 0);
65+
trig = trig | (isSCnt ? (1 << 3) : 0);
66+
trig = trig | (isCnt ? (1 << 4) : 0);
67+
mTrigger.nChanA = chanA;
68+
mTrigger.nChanC = chanC;
69+
mTrigger.amplA = aamplA;
70+
mTrigger.amplC = aamplC;
71+
mTrigger.timeA = atimeA;
72+
mTrigger.timeC = atimeC;
73+
}
74+
75+
const std::vector<ChannelData>& getChDgData() const { return mChDgDataArr; }
76+
std::vector<ChannelData>& getChDgData() { return mChDgDataArr; }
77+
void setChDgData(const std::vector<ChannelData>& ChDgDataArr) { mChDgDataArr = ChDgDataArr; }
78+
void setChDgData(std::vector<ChannelData>&& ChDgDataArr) { mChDgDataArr = std::move(ChDgDataArr); }
79+
80+
void printStream(std::ostream& stream) const;
81+
void cleardigits()
82+
{
83+
mChDgDataArr.clear();
84+
}
85+
86+
private:
87+
Double_t mTime; // time stamp
88+
o2::InteractionRecord mIntRecord; // Interaction record (orbit, bc)
89+
90+
std::vector<ChannelData> mChDgDataArr;
91+
92+
ClassDefNV(DigitsTemp, 1);
93+
};
94+
95+
std::ostream& operator<<(std::ostream& stream, const DigitsTemp& digi);
96+
} // namespace ft0
97+
} // namespace o2
98+
#endif

0 commit comments

Comments
 (0)