Skip to content

Commit 2137c13

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

File tree

4 files changed

+72
-19
lines changed

4 files changed

+72
-19
lines changed

Detectors/AOD/include/AODProducerWorkflow/AODProducerWorkflowSpec.h

Lines changed: 3 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

@@ -672,7 +673,7 @@ class AODProducerWorkflowDPL : public Task
672673
};
673674

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

677678
// helper interface for calo cells to "befriend" emcal and phos cells
678679
class CellHelper

Detectors/AOD/src/AODProducerWorkflowSpec.cxx

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1830,8 +1830,11 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
18301830
auto trackedV0Cursor = createTableCursor<o2::aod::TrackedV0s>(pc);
18311831
auto tracked3BodyCurs = createTableCursor<o2::aod::Tracked3Bodys>(pc);
18321832
auto fddCursor = createTableCursor<o2::aod::FDDs>(pc);
1833+
auto fddExtraCursor = createTableCursor<o2::aod::FDDsExtra>(pc);
18331834
auto ft0Cursor = createTableCursor<o2::aod::FT0s>(pc);
1835+
auto ft0ExtraCursor = createTableCursor<o2::aod::FT0sExtra>(pc);
18341836
auto fv0aCursor = createTableCursor<o2::aod::FV0As>(pc);
1837+
auto fv0aExtraCursor = createTableCursor<o2::aod::FV0AsExtra>(pc);
18351838
auto fwdTracksCursor = createTableCursor<o2::aod::StoredFwdTracks>(pc);
18361839
auto fwdTracksCovCursor = createTableCursor<o2::aod::StoredFwdTracksCov>(pc);
18371840
auto fwdTrkClsCursor = createTableCursor<o2::aod::FwdTrkCls>(pc);
@@ -1897,16 +1900,18 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
18971900
tfNumber = mTFNumber;
18981901
}
18991902

1900-
std::vector<float> aAmplitudes;
1903+
std::vector<float> aAmplitudes, aTimes;
19011904
std::vector<uint8_t> aChannels;
19021905
fv0aCursor.reserve(fv0RecPoints.size());
19031906
for (auto& fv0RecPoint : fv0RecPoints) {
19041907
aAmplitudes.clear();
19051908
aChannels.clear();
1909+
aTimes.clear();
19061910
const auto channelData = fv0RecPoint.getBunchChannelData(fv0ChData);
19071911
for (auto& channel : channelData) {
19081912
if (channel.charge > 0) {
19091913
aAmplitudes.push_back(truncateFloatFraction(channel.charge, mV0Amplitude));
1914+
aTimes.push_back(channel.time);
19101915
aChannels.push_back(channel.channel);
19111916
}
19121917
}
@@ -1923,6 +1928,11 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
19231928
aChannels,
19241929
truncateFloatFraction(fv0RecPoint.getCollisionGlobalMeanTime() * 1E-3, mV0Time), // ps to ns
19251930
fv0RecPoint.getTrigger().getTriggersignals());
1931+
1932+
if (mEnableFITextra) {
1933+
fv0aExtraCursor(bcID,
1934+
aTimes);
1935+
}
19261936
}
19271937

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

20282038
// vector of FDD amplitudes
2029-
int16_t aFDDAmplitudesA[8] = {0u};
2030-
int16_t aFDDAmplitudesC[8] = {0u};
2039+
int16_t aFDDAmplitudesA[8] = {0u}, aFDDAmplitudesC[8] = {0u};
2040+
float aFDDTimesA[8] = {0.f}, aFDDTimesC[8] = {0.f};
20312041
// filling FDD table
20322042
fddCursor.reserve(fddRecPoints.size());
20332043
for (const auto& fddRecPoint : fddRecPoints) {
20342044
for (int i = 0; i < 8; i++) {
20352045
aFDDAmplitudesA[i] = 0;
20362046
aFDDAmplitudesC[i] = 0;
2047+
aFDDTimesA[i] = 0.f;
2048+
aFDDTimesC[i] = 0.f;
20372049
}
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-
20482050
uint64_t globalBC = fddRecPoint.getInteractionRecord().toLong();
20492051
uint64_t bc = globalBC;
20502052
auto item = bcsMap.find(bc);
@@ -2054,21 +2056,39 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
20542056
} else {
20552057
LOG(fatal) << "Error: could not find a corresponding BC ID for a FDD rec. point; BC = " << bc;
20562058
}
2059+
const auto channelData = fddRecPoint.getBunchChannelData(fddChData);
2060+
for (const auto& channel : channelData) {
2061+
if (channel.mPMNumber < 8) {
2062+
aFDDAmplitudesC[channel.mPMNumber] = channel.mChargeADC; // amplitude
2063+
aFDDTimesC[channel.mPMNumber] = channel.mTime; // time
2064+
} else {
2065+
aFDDAmplitudesA[channel.mPMNumber - 8] = channel.mChargeADC; // amplitude
2066+
aFDDTimesA[channel.mPMNumber - 8] = channel.mTime; // time
2067+
}
2068+
}
2069+
20572070
fddCursor(bcID,
20582071
aFDDAmplitudesA,
20592072
aFDDAmplitudesC,
20602073
truncateFloatFraction(fddRecPoint.getCollisionTimeA() * 1E-3, mFDDTime), // ps to ns
20612074
truncateFloatFraction(fddRecPoint.getCollisionTimeC() * 1E-3, mFDDTime), // ps to ns
20622075
fddRecPoint.getTrigger().getTriggersignals());
2076+
if (mEnableFITextra) {
2077+
fddExtraCursor(bcID,
2078+
aFDDTimesA,
2079+
aFDDTimesC);
2080+
}
20632081
}
20642082

20652083
// filling FT0 table
2066-
std::vector<float> aAmplitudesA, aAmplitudesC;
2084+
std::vector<float> aAmplitudesA, aAmplitudesC, aTimesA, aTimesC;
20672085
std::vector<uint8_t> aChannelsA, aChannelsC;
20682086
ft0Cursor.reserve(ft0RecPoints.size());
20692087
for (auto& ft0RecPoint : ft0RecPoints) {
20702088
aAmplitudesA.clear();
20712089
aAmplitudesC.clear();
2090+
aTimesA.clear();
2091+
aTimesC.clear();
20722092
aChannelsA.clear();
20732093
aChannelsC.clear();
20742094
const auto channelData = ft0RecPoint.getBunchChannelData(ft0ChData);
@@ -2079,9 +2099,11 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
20792099
if (channel.ChId < nFT0ChannelsAside) {
20802100
aChannelsA.push_back(channel.ChId);
20812101
aAmplitudesA.push_back(truncateFloatFraction(channel.QTCAmpl, mT0Amplitude));
2102+
aTimesA.push_back(channel.CFDTime);
20822103
} else {
20832104
aChannelsC.push_back(channel.ChId - nFT0ChannelsAside);
20842105
aAmplitudesC.push_back(truncateFloatFraction(channel.QTCAmpl, mT0Amplitude));
2106+
aTimesC.push_back(channel.CFDTime);
20852107
}
20862108
}
20872109
}
@@ -2102,6 +2124,11 @@ void AODProducerWorkflowDPL::run(ProcessingContext& pc)
21022124
truncateFloatFraction(ft0RecPoint.getCollisionTimeA() * 1E-3, mT0Time), // ps to ns
21032125
truncateFloatFraction(ft0RecPoint.getCollisionTimeC() * 1E-3, mT0Time), // ps to ns
21042126
ft0RecPoint.getTrigger().getTriggersignals());
2127+
if (mEnableFITextra) {
2128+
ft0ExtraCursor(bcID,
2129+
aTimesA,
2130+
aTimesC);
2131+
}
21052132
}
21062133

21072134
if (mUseMC) {
@@ -3073,7 +3100,7 @@ void AODProducerWorkflowDPL::endOfStream(EndOfStreamContext& /*ec*/)
30733100
mStreamer.reset();
30743101
}
30753102

3076-
DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, bool enableStrangenessTracking, bool useMC, bool CTPConfigPerRun)
3103+
DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, bool enableStrangenessTracking, bool useMC, bool CTPConfigPerRun, bool enableFITextra)
30773104
{
30783105
auto dataRequest = std::make_shared<DataRequest>();
30793106
dataRequest->inputs.emplace_back("ctpconfig", "CTP", "CTPCONFIG", 0, Lifetime::Condition, ccdbParamSpec("CTP/Config/Config", CTPConfigPerRun));
@@ -3133,8 +3160,11 @@ DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, boo
31333160
OutputForTable<Collisions>::spec(),
31343161
OutputForTable<Decay3Bodys>::spec(),
31353162
OutputForTable<FDDs>::spec(),
3163+
OutputForTable<FDDsExtra>::spec(),
31363164
OutputForTable<FT0s>::spec(),
3165+
OutputForTable<FT0sExtra>::spec(),
31373166
OutputForTable<FV0As>::spec(),
3167+
OutputForTable<FV0AsExtra>::spec(),
31383168
OutputForTable<StoredFwdTracks>::spec(),
31393169
OutputForTable<StoredFwdTracksCov>::spec(),
31403170
OutputForTable<StoredMFTTracks>::spec(),
@@ -3183,7 +3213,7 @@ DataProcessorSpec getAODProducerWorkflowSpec(GID::mask_t src, bool enableSV, boo
31833213
"aod-producer-workflow",
31843214
dataRequest->inputs,
31853215
outputs,
3186-
AlgorithmSpec{adaptFromTask<AODProducerWorkflowDPL>(src, dataRequest, ggRequest, enableSV, useMC)},
3216+
AlgorithmSpec{adaptFromTask<AODProducerWorkflowDPL>(src, dataRequest, ggRequest, enableSV, useMC, enableFITextra)},
31873217
Options{
31883218
ConfigParamSpec{"run-number", VariantType::Int64, -1L, {"The run-number. If left default we try to get it from DPL header."}},
31893219
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)