Skip to content

Commit 7b4eade

Browse files
committed
Optionally add time of FIT channels to AO2D
Add output spec
1 parent 89375b5 commit 7b4eade

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
@@ -218,7 +218,7 @@ O2_DEFINE_ENUM_BIT_OPERATORS(AODProducerStreamerMask)
218218
class AODProducerWorkflowDPL : public Task
219219
{
220220
public:
221-
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) {}
221+
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) {}
222222
~AODProducerWorkflowDPL() override = default;
223223
void init(InitContext& ic) final;
224224
void run(ProcessingContext& pc) final;
@@ -257,6 +257,7 @@ class AODProducerWorkflowDPL : public Task
257257
int mNThreads = 1;
258258
bool mUseMC = true;
259259
bool mEnableSV = true; // enable secondary vertices
260+
bool mEnableFITextra = false;
260261
bool mFieldON = false;
261262
const float cSpeed = 0.029979246f; // speed of light in TOF units
262263

@@ -373,8 +374,11 @@ class AODProducerWorkflowDPL : public Task
373374
uint32_t mMuonCl = 0xFFFFFF00; // 15 bits
374375
uint32_t mMuonClErr = 0xFFFF0000; // 7 bits
375376
uint32_t mV0Time = 0xFFFFF000; // 11 bits
377+
uint32_t mV0ChannelTime = 0xFFFFFF00; // 15 bits
376378
uint32_t mFDDTime = 0xFFFFF000; // 11 bits
379+
uint32_t mFDDChannelTime = 0xFFFFFF00; // 15 bits
377380
uint32_t mT0Time = 0xFFFFFF00; // 15 bits
381+
uint32_t mT0ChannelTime = 0xFFFFFFF0; // 19 bits
378382
uint32_t mV0Amplitude = 0xFFFFF000; // 11 bits
379383
uint32_t mFDDAmplitude = 0xFFFFF000; // 11 bits
380384
uint32_t mT0Amplitude = 0xFFFFF000; // 11 bits
@@ -672,7 +676,7 @@ class AODProducerWorkflowDPL : public Task
672676
};
673677

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

677681
// helper interface for calo cells to "befriend" emcal and phos cells
678682
class CellHelper

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 49 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,8 +1744,11 @@ void AODProducerWorkflowDPL::init(InitContext& ic)
17441744
mMuonCl = 0xFFFFFFFF;
17451745
mMuonClErr = 0xFFFFFFFF;
17461746
mV0Time = 0xFFFFFFFF;
1747+
mV0ChannelTime = 0xFFFFFFFF;
17471748
mFDDTime = 0xFFFFFFFF;
1749+
mFDDChannelTime = 0xFFFFFFFF;
17481750
mT0Time = 0xFFFFFFFF;
1751+
mT0ChannelTime = 0xFFFFFFFF;
17491752
mV0Amplitude = 0xFFFFFFFF;
17501753
mFDDAmplitude = 0xFFFFFFFF;
17511754
mT0Amplitude = 0xFFFFFFFF;
@@ -1830,8 +1833,11 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
18301833
auto trackedV0Cursor = createTableCursor<o2::aod::TrackedV0s>(pc);
18311834
auto tracked3BodyCurs = createTableCursor<o2::aod::Tracked3Bodys>(pc);
18321835
auto fddCursor = createTableCursor<o2::aod::FDDs>(pc);
1836+
auto fddExtraCursor = createTableCursor<o2::aod::FDDsExtra>(pc);
18331837
auto ft0Cursor = createTableCursor<o2::aod::FT0s>(pc);
1838+
auto ft0ExtraCursor = createTableCursor<o2::aod::FT0sExtra>(pc);
18341839
auto fv0aCursor = createTableCursor<o2::aod::FV0As>(pc);
1840+
auto fv0aExtraCursor = createTableCursor<o2::aod::FV0AsExtra>(pc);
18351841
auto fwdTracksCursor = createTableCursor<o2::aod::StoredFwdTracks>(pc);
18361842
auto fwdTracksCovCursor = createTableCursor<o2::aod::StoredFwdTracksCov>(pc);
18371843
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(),
@@ -3183,7 +3216,7 @@ DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, boo
31833216
"aod-producer-workflow",
31843217
dataRequest->inputs,
31853218
outputs,
3186-
AlgorithmSpec{adaptFromTask<AODProducerWorkflowDPL>(src, dataRequest, ggRequest, enableSV, useMC)},
3219+
AlgorithmSpec{adaptFromTask<AODProducerWorkflowDPL>(src, dataRequest, ggRequest, enableSV, useMC, enableFITextra)},
31873220
Options{
31883221
ConfigParamSpec{"run-number", VariantType::Int64, -1L, {"The run-number. If left default we try to get it from DPL header."}},
31893222
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
@@ -1441,6 +1441,7 @@ namespace fv0a
14411441
{
14421442
DECLARE_SOA_INDEX_COLUMN(BC, bc); //! BC index
14431443
DECLARE_SOA_COLUMN(Amplitude, amplitude, std::vector<float>); //! Amplitudes of non-zero channels. The channel IDs are given in Channel (at the same index)
1444+
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
14441445
DECLARE_SOA_COLUMN(Channel, channel, std::vector<uint8_t>); //! Channel IDs which had non-zero amplitudes. There are at maximum 48 channels.
14451446
DECLARE_SOA_COLUMN(Time, time, float); //! Time in ns
14461447
DECLARE_SOA_COLUMN(TriggerMask, triggerMask, uint8_t); //!
@@ -1450,6 +1451,10 @@ DECLARE_SOA_TABLE(FV0As, "AOD", "FV0A", //!
14501451
o2::soa::Index<>, fv0a::BCId, fv0a::Amplitude, fv0a::Channel, fv0a::Time, fv0a::TriggerMask);
14511452
using FV0A = FV0As::iterator;
14521453

1454+
DECLARE_SOA_TABLE(FV0AsExtra, "AOD", "FV0AEXTRA", //! FV0AsExtra table
1455+
o2::soa::Index<>, fv0a::BCId, fv0a::TimeFV0A);
1456+
using FV0AExtra = FV0AsExtra::iterator;
1457+
14531458
// V0C table for Run2 only
14541459
namespace fv0c
14551460
{
@@ -1467,8 +1472,10 @@ namespace ft0
14671472
{
14681473
DECLARE_SOA_INDEX_COLUMN(BC, bc); //! BC index
14691474
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)
1475+
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
14701476
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.
14711477
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)
1478+
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
14721479
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.
14731480
DECLARE_SOA_COLUMN(TimeA, timeA, float); //! Average A-side time
14741481
DECLARE_SOA_COLUMN(TimeC, timeC, float); //! Average C-side time
@@ -1512,6 +1519,11 @@ DECLARE_SOA_TABLE(FT0s, "AOD", "FT0", //!
15121519
ft0::SumAmpA<ft0::AmplitudeA>, ft0::SumAmpC<ft0::AmplitudeC>);
15131520
using FT0 = FT0s::iterator;
15141521

1522+
DECLARE_SOA_TABLE(FT0sExtra, "AOD", "FT0EXTRA", //! FT0sExtra table
1523+
o2::soa::Index<>, ft0::BCId,
1524+
ft0::TimeFT0A, ft0::TimeFT0C);
1525+
using FT0Extra = FT0sExtra::iterator;
1526+
15151527
namespace fdd
15161528
{
15171529
DECLARE_SOA_INDEX_COLUMN(BC, bc); //! BC index
@@ -1521,6 +1533,9 @@ DECLARE_SOA_COLUMN(AmplitudeC, amplitudeC, float[4]); //! Amplitude in adjacent
15211533
DECLARE_SOA_COLUMN(ChargeA, chargeA, int16_t[8]); //! Amplitude per channel A-side
15221534
DECLARE_SOA_COLUMN(ChargeC, chargeC, int16_t[8]); //! Amplitude per channel C-side
15231535

1536+
DECLARE_SOA_COLUMN(TimeFDDA, timeFDDA, float[8]); //! Time per channel A-side, only for the FITExtra table
1537+
DECLARE_SOA_COLUMN(TimeFDDC, timeFDDC, float[8]); //! Time per channel C-side, only for the FITExtra table
1538+
15241539
DECLARE_SOA_COLUMN(TimeA, timeA, float); //!
15251540
DECLARE_SOA_COLUMN(TimeC, timeC, float); //!
15261541
DECLARE_SOA_COLUMN(TriggerMask, triggerMask, uint8_t); //!
@@ -1542,6 +1557,11 @@ DECLARE_SOA_TABLE_VERSIONED(FDDs_001, "AOD", "FDD", 1, //! FDD table, version 00
15421557
using FDDs = FDDs_001; //! this defines the current default version
15431558
using FDD = FDDs::iterator;
15441559

1560+
DECLARE_SOA_TABLE(FDDsExtra, "AOD", "FDDEXTRA", //! FDDsExtra table
1561+
o2::soa::Index<>, fdd::BCId,
1562+
fdd::TimeFDDA, fdd::TimeFDDC);
1563+
using FDDExtra = FDDsExtra::iterator;
1564+
15451565
namespace v0
15461566
{
15471567
DECLARE_SOA_INDEX_COLUMN_FULL(PosTrack, posTrack, int, Tracks, "_Pos"); //! Positive track

0 commit comments

Comments
 (0)