Skip to content

Commit

Permalink
AOD: switch to flag class for streamer steering
Browse files Browse the repository at this point in the history
  • Loading branch information
f3sch authored and sawenzel committed Jan 9, 2025
1 parent 773a098 commit 11f7b5c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "ZDCBase/Constants.h"
#include "GlobalTracking/MatchGlobalFwd.h"
#include "CommonUtils/TreeStreamRedirector.h"
#include "CommonUtils/EnumBitOperators.h"
#include "CommonUtils/EnumFlags.h"

#include <cstdint>
#include <limits>
Expand Down Expand Up @@ -208,12 +208,9 @@ class BunchCrossings
}; // end internal class

// Steering bits for additional output during AOD production
enum struct AODProducerStreamerMask : uint8_t {
None = 0,
TrackQA = O2_ENUM_SET_BIT(0),
All = std::numeric_limits<std::underlying_type_t<AODProducerStreamerMask>>::max(),
enum struct AODProducerStreamerFlags : uint8_t {
TrackQA,
};
O2_DEFINE_ENUM_BIT_OPERATORS(AODProducerStreamerMask)

class AODProducerWorkflowDPL : public Task
{
Expand Down Expand Up @@ -251,7 +248,7 @@ class AODProducerWorkflowDPL : public Task
std::unordered_set<GIndex> mGIDUsedBySVtx;
std::unordered_set<GIndex> mGIDUsedByStr;

AODProducerStreamerMask mStreamerMask{0};
o2::utils::EnumFlags<AODProducerStreamerFlags> mStreamerFlags;
std::shared_ptr<o2::utils::TreeStreamRedirector> mStreamer;

int mNThreads = 1;
Expand Down
11 changes: 6 additions & 5 deletions Detectors/AOD/src/AODProducerWorkflowSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1675,9 +1675,10 @@ void AODProducerWorkflowDPL::init(InitContext& ic)
mPropTracks = ic.options().get<bool>("propagate-tracks");
mPropMuons = ic.options().get<bool>("propagate-muons");
if (auto s = ic.options().get<std::string>("with-streamers"); !s.empty()) {
mStreamerMask = static_cast<AODProducerStreamerMask>(std::stoul(s, nullptr, 2));
if (O2_ENUM_ANY_BIT(mStreamerMask)) {
LOGP(info, "Writing streamer data with mask {:0{}b}", static_cast<std::underlying_type_t<AODProducerStreamerMask>>(mStreamerMask), std::numeric_limits<std::underlying_type_t<AODProducerStreamerMask>>::digits);
mStreamerFlags.set(s);
if (mStreamerFlags) {
LOGP(info, "Writing streamer data with mask:");
LOG(info) << mStreamerFlags;
} else {
LOGP(warn, "Specified non-default empty streamer mask!");
}
Expand Down Expand Up @@ -1768,7 +1769,7 @@ void AODProducerWorkflowDPL::init(InitContext& ic)

mTimer.Reset();

if (O2_ENUM_ANY_BIT(mStreamerMask)) {
if (mStreamerFlags) {
mStreamer = std::make_unique<o2::utils::TreeStreamRedirector>("AO2DStreamer.root", "RECREATE");
}
}
Expand Down Expand Up @@ -2654,7 +2655,7 @@ AODProducerWorkflowDPL::TrackQA AODProducerWorkflowDPL::processBarrelTrackQA(int
trackQAHolder.dRefGloQ2Pt = safeInt8Clamp(((itsCopy.getQ2Pt() + tpcCopy.getQ2Pt()) * 0.5f - gloCopy.getQ2Pt()) * scaleGlo(4));
//

if (O2_ENUM_TEST_BIT(mStreamerMask, AODProducerStreamerMask::TrackQA)) {
if (mStreamerFlags[AODProducerStreamerFlags::TrackQA]) {
(*mStreamer) << "trackQA"
<< "trackITSOrig=" << itsOrig
<< "trackTPCOrig=" << tpcOrig
Expand Down

0 comments on commit 11f7b5c

Please sign in to comment.