Skip to content

Commit b00bfe5

Browse files
authored
Optionally add time of FIT channels to AO2D (#13857)
Add output spec
1 parent 7d4b3dc commit b00bfe5

File tree

4 files changed

+78
-19
lines changed

4 files changed

+78
-19
lines changed

Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ enum struct AODProducerStreamerFlags : uint8_t {
215215
class AODProducerWorkflowDPL : public Task
216216
{
217217
public:
218-
AODProducerWorkflowDPL(GID::mask_t src, std::shared_ptr<DataRequest> dataRequest, std::shared_ptr<o2::base::GRPGeomRequest> gr, bool enableSV, bool useMC = true) : mUseMC(useMC), mEnableSV(enableSV), mInputSources(src), mDataRequest(dataRequest), mGGCCDBRequest(gr) {}
218+
AODProducerWorkflowDPL(GID::mask_t src, std::shared_ptr<DataRequest> dataRequest, std::shared_ptr<o2::base::GRPGeomRequest> gr, bool enableSV, bool useMC = true, bool enableFITextra = false) : mUseMC(useMC), mEnableSV(enableSV), mEnableFITextra(enableFITextra), mInputSources(src), mDataRequest(dataRequest), mGGCCDBRequest(gr) {}
219219
~AODProducerWorkflowDPL() override = default;
220220
void init(InitContext& ic) final;
221221
void run(ProcessingContext& pc) final;
@@ -254,6 +254,7 @@ class AODProducerWorkflowDPL : public Task
254254
int mNThreads = 1;
255255
bool mUseMC = true;
256256
bool mEnableSV = true; // enable secondary vertices
257+
bool mEnableFITextra = false;
257258
bool mFieldON = false;
258259
const float cSpeed = 0.029979246f; // speed of light in TOF units
259260

@@ -370,8 +371,11 @@ class AODProducerWorkflowDPL : public Task
370371
uint32_t mMuonCl = 0xFFFFFF00; // 15 bits
371372
uint32_t mMuonClErr = 0xFFFF0000; // 7 bits
372373
uint32_t mV0Time = 0xFFFFF000; // 11 bits
374+
uint32_t mV0ChannelTime = 0xFFFFFF00; // 15 bits
373375
uint32_t mFDDTime = 0xFFFFF000; // 11 bits
376+
uint32_t mFDDChannelTime = 0xFFFFFF00; // 15 bits
374377
uint32_t mT0Time = 0xFFFFFF00; // 15 bits
378+
uint32_t mT0ChannelTime = 0xFFFFFFF0; // 19 bits
375379
uint32_t mV0Amplitude = 0xFFFFF000; // 11 bits
376380
uint32_t mFDDAmplitude = 0xFFFFF000; // 11 bits
377381
uint32_t mT0Amplitude = 0xFFFFF000; // 11 bits
@@ -668,7 +672,7 @@ class AODProducerWorkflowDPL : public Task
668672
};
669673

670674
/// create a processor spec
671-
framework::DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, bool enableST, bool useMC, bool CTPConfigPerRun);
675+
framework::DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, bool enableST, bool useMC, bool CTPConfigPerRun, bool enableFITextra);
672676

673677
// helper interface for calo cells to "befriend" emcal and phos cells
674678
class CellHelper

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1743,8 +1743,11 @@ void AODProducerWorkflowDPL::init(InitContext& ic)
17431743
mMuonCl = 0xFFFFFFFF;
17441744
mMuonClErr = 0xFFFFFFFF;
17451745
mV0Time = 0xFFFFFFFF;
1746+
mV0ChannelTime = 0xFFFFFFFF;
17461747
mFDDTime = 0xFFFFFFFF;
1748+
mFDDChannelTime = 0xFFFFFFFF;
17471749
mT0Time = 0xFFFFFFFF;
1750+
mT0ChannelTime = 0xFFFFFFFF;
17481751
mV0Amplitude = 0xFFFFFFFF;
17491752
mFDDAmplitude = 0xFFFFFFFF;
17501753
mT0Amplitude = 0xFFFFFFFF;
@@ -1829,8 +1832,11 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
18291832
auto trackedV0Cursor = createTableCursor<o2::aod::TrackedV0s>(pc);
18301833
auto tracked3BodyCurs = createTableCursor<o2::aod::Tracked3Bodys>(pc);
18311834
auto fddCursor = createTableCursor<o2::aod::FDDs>(pc);
1835+
auto fddExtraCursor = createTableCursor<o2::aod::FDDsExtra>(pc);
18321836
auto ft0Cursor = createTableCursor<o2::aod::FT0s>(pc);
1837+
auto ft0ExtraCursor = createTableCursor<o2::aod::FT0sExtra>(pc);
18331838
auto fv0aCursor = createTableCursor<o2::aod::FV0As>(pc);
1839+
auto fv0aExtraCursor = createTableCursor<o2::aod::FV0AsExtra>(pc);
18341840
auto fwdTracksCursor = createTableCursor<o2::aod::StoredFwdTracks>(pc);
18351841
auto fwdTracksCovCursor = createTableCursor<o2::aod::StoredFwdTracksCov>(pc);
18361842
auto fwdTrkClsCursor = createTableCursor<o2::aod::FwdTrkCls>(pc);
@@ -1897,16 +1903,18 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
18971903
tfNumber = mTFNumber;
18981904
}
18991905

1900-
std::vector<float> aAmplitudes;
1906+
std::vector<float> aAmplitudes, aTimes;
19011907
std::vector<uint8_t> aChannels;
19021908
fv0aCursor.reserve(fv0RecPoints.size());
19031909
for (auto& fv0RecPoint : fv0RecPoints) {
19041910
aAmplitudes.clear();
19051911
aChannels.clear();
1912+
aTimes.clear();
19061913
const auto channelData = fv0RecPoint.getBunchChannelData(fv0ChData);
19071914
for (auto& channel : channelData) {
19081915
if (channel.charge > 0) {
19091916
aAmplitudes.push_back(truncateFloatFraction(channel.charge, mV0Amplitude));
1917+
aTimes.push_back(truncateFloatFraction(channel.time * 1.E-3, mV0ChannelTime));
19101918
aChannels.push_back(channel.channel);
19111919
}
19121920
}
@@ -1923,6 +1931,11 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
19231931
aChannels,
19241932
truncateFloatFraction(fv0RecPoint.getCollisionGlobalMeanTime() * 1E-3, mV0Time), // ps to ns
19251933
fv0RecPoint.getTrigger().getTriggersignals());
1934+
1935+
if (mEnableFITextra) {
1936+
fv0aExtraCursor(bcID,
1937+
aTimes);
1938+
}
19261939
}
19271940

19281941
std::vector<float> zdcEnergy, zdcAmplitudes, zdcTime;
@@ -2026,25 +2039,17 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
20262039
[](const std::vector<int>& left, const std::vector<int>& right) { return (left[0] < right[0]); });
20272040

20282041
// vector of FDD amplitudes
2029-
int16_t aFDDAmplitudesA[8] = {0u};
2030-
int16_t aFDDAmplitudesC[8] = {0u};
2042+
int16_t aFDDAmplitudesA[8] = {0u}, aFDDAmplitudesC[8] = {0u};
2043+
float aFDDTimesA[8] = {0.f}, aFDDTimesC[8] = {0.f};
20312044
// filling FDD table
20322045
fddCursor.reserve(fddRecPoints.size());
20332046
for (const auto& fddRecPoint : fddRecPoints) {
20342047
for (int i = 0; i < 8; i++) {
20352048
aFDDAmplitudesA[i] = 0;
20362049
aFDDAmplitudesC[i] = 0;
2050+
aFDDTimesA[i] = 0.f;
2051+
aFDDTimesC[i] = 0.f;
20372052
}
2038-
2039-
const auto channelData = fddRecPoint.getBunchChannelData(fddChData);
2040-
for (const auto& channel : channelData) {
2041-
if (channel.mPMNumber < 8) {
2042-
aFDDAmplitudesC[channel.mPMNumber] = channel.mChargeADC; // amplitude
2043-
} else {
2044-
aFDDAmplitudesA[channel.mPMNumber - 8] = channel.mChargeADC; // amplitude
2045-
}
2046-
}
2047-
20482053
uint64_t globalBC = fddRecPoint.getInteractionRecord().toLong();
20492054
uint64_t bc = globalBC;
20502055
auto item = bcsMap.find(bc);
@@ -2054,21 +2059,39 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
20542059
} else {
20552060
LOG(fatal) << "Error: could not find a corresponding BC ID for a FDD rec. point; BC = " << bc;
20562061
}
2062+
const auto channelData = fddRecPoint.getBunchChannelData(fddChData);
2063+
for (const auto& channel : channelData) {
2064+
if (channel.mPMNumber < 8) {
2065+
aFDDAmplitudesC[channel.mPMNumber] = channel.mChargeADC; // amplitude
2066+
aFDDTimesC[channel.mPMNumber] = truncateFloatFraction(channel.mTime * 1E-3, mFDDChannelTime); // time
2067+
} else {
2068+
aFDDAmplitudesA[channel.mPMNumber - 8] = channel.mChargeADC; // amplitude
2069+
aFDDTimesA[channel.mPMNumber - 8] = truncateFloatFraction(channel.mTime * 1E-3, mFDDChannelTime); // time
2070+
}
2071+
}
2072+
20572073
fddCursor(bcID,
20582074
aFDDAmplitudesA,
20592075
aFDDAmplitudesC,
20602076
truncateFloatFraction(fddRecPoint.getCollisionTimeA() * 1E-3, mFDDTime), // ps to ns
20612077
truncateFloatFraction(fddRecPoint.getCollisionTimeC() * 1E-3, mFDDTime), // ps to ns
20622078
fddRecPoint.getTrigger().getTriggersignals());
2079+
if (mEnableFITextra) {
2080+
fddExtraCursor(bcID,
2081+
aFDDTimesA,
2082+
aFDDTimesC);
2083+
}
20632084
}
20642085

20652086
// filling FT0 table
2066-
std::vector<float> aAmplitudesA, aAmplitudesC;
2087+
std::vector<float> aAmplitudesA, aAmplitudesC, aTimesA, aTimesC;
20672088
std::vector<uint8_t> aChannelsA, aChannelsC;
20682089
ft0Cursor.reserve(ft0RecPoints.size());
20692090
for (auto& ft0RecPoint : ft0RecPoints) {
20702091
aAmplitudesA.clear();
20712092
aAmplitudesC.clear();
2093+
aTimesA.clear();
2094+
aTimesC.clear();
20722095
aChannelsA.clear();
20732096
aChannelsC.clear();
20742097
const auto channelData = ft0RecPoint.getBunchChannelData(ft0ChData);
@@ -2079,9 +2102,11 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
20792102
if (channel.ChId < nFT0ChannelsAside) {
20802103
aChannelsA.push_back(channel.ChId);
20812104
aAmplitudesA.push_back(truncateFloatFraction(channel.QTCAmpl, mT0Amplitude));
2105+
aTimesA.push_back(truncateFloatFraction(channel.CFDTime * 1E-3, mT0ChannelTime));
20822106
} else {
20832107
aChannelsC.push_back(channel.ChId - nFT0ChannelsAside);
20842108
aAmplitudesC.push_back(truncateFloatFraction(channel.QTCAmpl, mT0Amplitude));
2109+
aTimesC.push_back(truncateFloatFraction(channel.CFDTime * 1E-3, mT0ChannelTime));
20852110
}
20862111
}
20872112
}
@@ -2102,6 +2127,11 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
21022127
truncateFloatFraction(ft0RecPoint.getCollisionTimeA() * 1E-3, mT0Time), // ps to ns
21032128
truncateFloatFraction(ft0RecPoint.getCollisionTimeC() * 1E-3, mT0Time), // ps to ns
21042129
ft0RecPoint.getTrigger().getTriggersignals());
2130+
if (mEnableFITextra) {
2131+
ft0ExtraCursor(bcID,
2132+
aTimesA,
2133+
aTimesC);
2134+
}
21052135
}
21062136

21072137
if (mUseMC) {
@@ -3073,7 +3103,7 @@ void AODProducerWorkflowDPL::endOfStream(EndOfStreamContext& /*ec*/)
30733103
mStreamer.reset();
30743104
}
30753105

3076-
DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, bool enableStrangenessTracking, bool useMC, bool CTPConfigPerRun)
3106+
DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, bool enableStrangenessTracking, bool useMC, bool CTPConfigPerRun, bool enableFITextra)
30773107
{
30783108
auto dataRequest = std::make_shared<DataRequest>();
30793109
dataRequest->inputs.emplace_back("ctpconfig", "CTP", "CTPCONFIG", 0, Lifetime::Condition, ccdbParamSpec("CTP/Config/Config", CTPConfigPerRun));
@@ -3133,8 +3163,11 @@ DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, boo
31333163
OutputForTable<Collisions>::spec(),
31343164
OutputForTable<Decay3Bodys>::spec(),
31353165
OutputForTable<FDDs>::spec(),
3166+
OutputForTable<FDDsExtra>::spec(),
31363167
OutputForTable<FT0s>::spec(),
3168+
OutputForTable<FT0sExtra>::spec(),
31373169
OutputForTable<FV0As>::spec(),
3170+
OutputForTable<FV0AsExtra>::spec(),
31383171
OutputForTable<StoredFwdTracks>::spec(),
31393172
OutputForTable<StoredFwdTracksCov>::spec(),
31403173
OutputForTable<StoredMFTTracks>::spec(),
@@ -3184,7 +3217,7 @@ DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, boo
31843217
"aod-producer-workflow",
31853218
dataRequest->inputs,
31863219
outputs,
3187-
AlgorithmSpec{adaptFromTask<AODProducerWorkflowDPL>(src, dataRequest, ggRequest, enableSV, useMC)},
3220+
AlgorithmSpec{adaptFromTask<AODProducerWorkflowDPL>(src, dataRequest, ggRequest, enableSV, useMC, enableFITextra)},
31883221
Options{
31893222
ConfigParamSpec{"run-number", VariantType::Int64, -1L, {"The run-number. If left default we try to get it from DPL header."}},
31903223
ConfigParamSpec{"aod-timeframe-id", VariantType::Int64, -1L, {"Set timeframe number"}},

Detectors/AOD/src/aod-producer-workflow.cxx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ void customize(std::vector<ConfigParamSpec>& workflowOptions)
3737
{"disable-mc", o2::framework::VariantType::Bool, false, {"disable MC propagation"}},
3838
{"disable-secondary-vertices", o2::framework::VariantType::Bool, false, {"disable filling secondary vertices"}},
3939
{"disable-strangeness-tracker", o2::framework::VariantType::Bool, false, {"disable filling strangeness tracking"}},
40+
{"enable-FIT-extra", o2::framework::VariantType::Bool, false, {"enable FIT extra output"}},
4041
{"info-sources", VariantType::String, std::string{GID::ALL}, {"comma-separated list of sources to use"}},
4142
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}},
4243
{"combine-source-devices", o2::framework::VariantType::Bool, false, {"merge DPL source devices"}},
@@ -54,6 +55,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
5455
bool enableSV = !configcontext.options().get<bool>("disable-secondary-vertices");
5556
bool enableST = !configcontext.options().get<bool>("disable-strangeness-tracker");
5657
bool ctpcfgperrun = !configcontext.options().get<bool>("ctpconfig-run-independent");
58+
bool enableFITextra = configcontext.options().get<bool>("enable-FIT-extra");
5759

5860
GID::mask_t allowedSrc = GID::getSourcesMask("ITS,MFT,MCH,MID,MCH-MID,TPC,TRD,ITS-TPC,TPC-TOF,TPC-TRD,ITS-TPC-TOF,ITS-TPC-TRD,TPC-TRD-TOF,ITS-TPC-TRD-TOF,MFT-MCH,FT0,FV0,FDD,ZDC,EMC,CTP,PHS,CPV,HMP");
5961
GID::mask_t src = allowedSrc & GID::getSourcesMask(configcontext.options().get<std::string>("info-sources"));
@@ -64,7 +66,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
6466
}
6567

6668
WorkflowSpec specs;
67-
specs.emplace_back(o2::aodproducer::getAODProducerWorkflowSpec(src, enableSV, enableST, useMC, ctpcfgperrun));
69+
specs.emplace_back(o2::aodproducer::getAODProducerWorkflowSpec(src, enableSV, enableST, useMC, ctpcfgperrun, enableFITextra));
6870

6971
auto srcCls = src & ~(GID::getSourceMask(GID::MCH) | GID::getSourceMask(GID::MID)); // Don't read global MID and MCH clusters (those attached to tracks are always read)
7072
auto srcMtc = src;

Framework/Core/include/Framework/AnalysisDataModel.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,6 +1467,7 @@ namespace fv0a
14671467
{
14681468
DECLARE_SOA_INDEX_COLUMN(BC, bc); //! BC index
14691469
DECLARE_SOA_COLUMN(Amplitude, amplitude, std::vector<float>); //! Amplitudes of non-zero channels. The channel IDs are given in Channel (at the same index)
1470+
DECLARE_SOA_COLUMN(TimeFV0A, timeFV0A, std::vector<float>); //! Time of non-zero channels. The channel IDs are given in Channel (at the same index). Only for the FITExtra table
14701471
DECLARE_SOA_COLUMN(Channel, channel, std::vector<uint8_t>); //! Channel IDs which had non-zero amplitudes. There are at maximum 48 channels.
14711472
DECLARE_SOA_COLUMN(Time, time, float); //! Time in ns
14721473
DECLARE_SOA_COLUMN(TriggerMask, triggerMask, uint8_t); //!
@@ -1476,6 +1477,10 @@ DECLARE_SOA_TABLE(FV0As, "AOD", "FV0A", //!
14761477
o2::soa::Index<>, fv0a::BCId, fv0a::Amplitude, fv0a::Channel, fv0a::Time, fv0a::TriggerMask);
14771478
using FV0A = FV0As::iterator;
14781479

1480+
DECLARE_SOA_TABLE(FV0AsExtra, "AOD", "FV0AEXTRA", //! FV0AsExtra table
1481+
o2::soa::Index<>, fv0a::BCId, fv0a::TimeFV0A);
1482+
using FV0AExtra = FV0AsExtra::iterator;
1483+
14791484
// V0C table for Run2 only
14801485
namespace fv0c
14811486
{
@@ -1493,8 +1498,10 @@ namespace ft0
14931498
{
14941499
DECLARE_SOA_INDEX_COLUMN(BC, bc); //! BC index
14951500
DECLARE_SOA_COLUMN(AmplitudeA, amplitudeA, std::vector<float>); //! Amplitudes of non-zero channels on the A-side. The channel IDs are given in ChannelA (at the same index)
1501+
DECLARE_SOA_COLUMN(TimeFT0A, timeFT0A, std::vector<float>); //! Time of non-zero channels on the A-side. The channel IDs are given in ChannelA (at the same index). Only for the FITExtra table
14961502
DECLARE_SOA_COLUMN(ChannelA, channelA, std::vector<uint8_t>); //! Channel IDs on the A side which had non-zero amplitudes. There are at maximum 96 channels.
14971503
DECLARE_SOA_COLUMN(AmplitudeC, amplitudeC, std::vector<float>); //! Amplitudes of non-zero channels on the C-side. The channel IDs are given in ChannelC (at the same index)
1504+
DECLARE_SOA_COLUMN(TimeFT0C, timeFT0C, std::vector<float>); //! Time of non-zero channels on the C-side. The channel IDs are given in ChannelC (at the same index). Only for the FITExtra table
14981505
DECLARE_SOA_COLUMN(ChannelC, channelC, std::vector<uint8_t>); //! Channel IDs on the C side which had non-zero amplitudes. There are at maximum 112 channels.
14991506
DECLARE_SOA_COLUMN(TimeA, timeA, float); //! Average A-side time
15001507
DECLARE_SOA_COLUMN(TimeC, timeC, float); //! Average C-side time
@@ -1538,6 +1545,11 @@ DECLARE_SOA_TABLE(FT0s, "AOD", "FT0", //!
15381545
ft0::SumAmpA<ft0::AmplitudeA>, ft0::SumAmpC<ft0::AmplitudeC>);
15391546
using FT0 = FT0s::iterator;
15401547

1548+
DECLARE_SOA_TABLE(FT0sExtra, "AOD", "FT0EXTRA", //! FT0sExtra table
1549+
o2::soa::Index<>, ft0::BCId,
1550+
ft0::TimeFT0A, ft0::TimeFT0C);
1551+
using FT0Extra = FT0sExtra::iterator;
1552+
15411553
namespace fdd
15421554
{
15431555
DECLARE_SOA_INDEX_COLUMN(BC, bc); //! BC index
@@ -1547,6 +1559,9 @@ DECLARE_SOA_COLUMN(AmplitudeC, amplitudeC, float[4]); //! Amplitude in adjacent
15471559
DECLARE_SOA_COLUMN(ChargeA, chargeA, int16_t[8]); //! Amplitude per channel A-side
15481560
DECLARE_SOA_COLUMN(ChargeC, chargeC, int16_t[8]); //! Amplitude per channel C-side
15491561

1562+
DECLARE_SOA_COLUMN(TimeFDDA, timeFDDA, float[8]); //! Time per channel A-side, only for the FITExtra table
1563+
DECLARE_SOA_COLUMN(TimeFDDC, timeFDDC, float[8]); //! Time per channel C-side, only for the FITExtra table
1564+
15501565
DECLARE_SOA_COLUMN(TimeA, timeA, float); //!
15511566
DECLARE_SOA_COLUMN(TimeC, timeC, float); //!
15521567
DECLARE_SOA_COLUMN(TriggerMask, triggerMask, uint8_t); //!
@@ -1568,6 +1583,11 @@ DECLARE_SOA_TABLE_VERSIONED(FDDs_001, "AOD", "FDD", 1, //! FDD table, version 00
15681583
using FDDs = FDDs_001; //! this defines the current default version
15691584
using FDD = FDDs::iterator;
15701585

1586+
DECLARE_SOA_TABLE(FDDsExtra, "AOD", "FDDEXTRA", //! FDDsExtra table
1587+
o2::soa::Index<>, fdd::BCId,
1588+
fdd::TimeFDDA, fdd::TimeFDDC);
1589+
using FDDExtra = FDDsExtra::iterator;
1590+
15711591
namespace v0
15721592
{
15731593
DECLARE_SOA_INDEX_COLUMN_FULL(PosTrack, posTrack, int, Tracks, "_Pos"); //! Positive track

0 commit comments

Comments
 (0)