diff --git a/Common/TableProducer/multiplicityExtraTable.cxx b/Common/TableProducer/multiplicityExtraTable.cxx index fcbacf7b80e..f9cd6f0d424 100644 --- a/Common/TableProducer/multiplicityExtraTable.cxx +++ b/Common/TableProducer/multiplicityExtraTable.cxx @@ -8,6 +8,8 @@ // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. +#include // megalinter thinks this is a C header... +#include #include "Framework/ConfigParamSpec.h" #include "Framework/runDataProcessing.h" #include "Framework/AnalysisTask.h" @@ -16,13 +18,10 @@ #include "Common/DataModel/Multiplicity.h" #include "DataFormatsFIT/Triggers.h" #include "TableHelper.h" - #include "CCDB/CcdbApi.h" #include "CommonDataFormat/BunchFilling.h" -#include #include "DataFormatsParameters/GRPObject.h" #include "DataFormatsParameters/GRPLHCIFData.h" -#include using namespace o2; using namespace o2::framework; @@ -34,6 +33,12 @@ struct MultiplicityExtraTable { Produces multBC; Produces multNeigh; + // Allow for downscaling of BC table for less space use in derived data + Configurable bcDownscaleFactor{"bcDownscaleFactor", 2, "Downscale factor for BC table (0: save nothing, 1: save all)"}; + + // needed for downscale + unsigned int randomSeed = 0; + o2::ccdb::CcdbApi ccdbApi; Service ccdb; BCPattern CollidingBunch; @@ -43,6 +48,8 @@ struct MultiplicityExtraTable { void init(InitContext&) { + randomSeed = static_cast(std::chrono::duration_cast(std::chrono::system_clock::now().time_since_epoch()).count()); + ccdbApi.init("http://alice-ccdb.cern.ch"); ccdb->setURL("http://alice-ccdb.cern.ch"); ccdb->setCaching(true); @@ -53,6 +60,11 @@ struct MultiplicityExtraTable { void processBCs(BCsWithRun3Matchings::iterator const& bc, aod::FV0As const&, aod::FT0s const&, aod::FDDs const&, aod::Zdcs const&) { + // downscale if requested to do so + if (bcDownscaleFactor < 1.f && (static_cast(rand_r(&randomSeed)) / static_cast(RAND_MAX)) > bcDownscaleFactor) { + return; + } + bool Tvx = false; bool isFV0OrA = false; float multFT0C = 0.f;