88// In applying this license CERN does not waive the privileges and immunities
99// granted to it by virtue of its status as an Intergovernmental Organization
1010// or submit itself to any jurisdiction.
11+ #include < CCDB/BasicCCDBManager.h> // megalinter thinks this is a C header...
12+ #include < bitset>
1113#include " Framework/ConfigParamSpec.h"
1214#include " Framework/runDataProcessing.h"
1315#include " Framework/AnalysisTask.h"
1618#include " Common/DataModel/Multiplicity.h"
1719#include " DataFormatsFIT/Triggers.h"
1820#include " TableHelper.h"
19-
2021#include " CCDB/CcdbApi.h"
2122#include " CommonDataFormat/BunchFilling.h"
22- #include < CCDB/BasicCCDBManager.h>
2323#include " DataFormatsParameters/GRPObject.h"
2424#include " DataFormatsParameters/GRPLHCIFData.h"
25- #include < bitset>
2625
2726using namespace o2 ;
2827using namespace o2 ::framework;
@@ -34,6 +33,12 @@ struct MultiplicityExtraTable {
3433 Produces<aod::MultsBC> multBC;
3534 Produces<aod::MultNeighs> multNeigh;
3635
36+ // Allow for downscaling of BC table for less space use in derived data
37+ Configurable<float > bcDownscaleFactor{" bcDownscaleFactor" , 2 , " Downscale factor for BC table (0: save nothing, 1: save all)" };
38+
39+ // needed for downscale
40+ unsigned int randomSeed = 0 ;
41+
3742 o2::ccdb::CcdbApi ccdbApi;
3843 Service<o2::ccdb::BasicCCDBManager> ccdb;
3944 BCPattern CollidingBunch;
@@ -43,6 +48,8 @@ struct MultiplicityExtraTable {
4348
4449 void init (InitContext&)
4550 {
51+ randomSeed = static_cast <unsigned int >(std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now ().time_since_epoch ()).count ());
52+
4653 ccdbApi.init (" http://alice-ccdb.cern.ch" );
4754 ccdb->setURL (" http://alice-ccdb.cern.ch" );
4855 ccdb->setCaching (true );
@@ -53,6 +60,11 @@ struct MultiplicityExtraTable {
5360
5461 void processBCs (BCsWithRun3Matchings::iterator const & bc, aod::FV0As const &, aod::FT0s const &, aod::FDDs const &, aod::Zdcs const &)
5562 {
63+ // downscale if requested to do so
64+ if (bcDownscaleFactor < 1 .f && (static_cast <float >(rand_r (&randomSeed)) / static_cast <float >(RAND_MAX)) > bcDownscaleFactor) {
65+ return ;
66+ }
67+
5668 bool Tvx = false ;
5769 bool isFV0OrA = false ;
5870 float multFT0C = 0 .f ;
0 commit comments